If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

I’ve recently been reviewing the code for my Entity Framework (simple O/R Mapping, Entity validation, etc) to determine if I should consider swapping out the O/R Mapping for something else such as NHibernate, NPersist, Wilson OR Mapper, etc.  The reason I’ve been considering this is that swapping out the O/R Mapping functionality within my Entity Framework with one of the more widely used frameworks may make it easier for people to extend ActiveType (CMS) for their unique needs.

As part of my review I was investigating the differences in functionality between the other O/R Mappers out there and the lightweight O/R mapper I’ve developed in my base Entity Framework.  There are a lot of obvious differences, but, as you might be able to tell from the title of this post I’m going to focus on how the mapping is configured in the various O/R Mappers.  Most O/R Mapping products out there today have the mapping of objects to database tables defined in an external configuration file.  There are some (mine included) that define the mapping within the classes themselves via custom attributes. 

I’ve recently been reading up on Indigo and as I’ve worked through all the code samples I couldn’t help but notice their extensive use of attributes.  Although O/R Mapping and Indigo are clearly not one in the same I can’t help but notice the obvious similarities.  I can’t help but think there are others that agree:

One last point, [DataContract] is just not an "Indigo" feature -- it is a feature for the entire .Net Framework.

Thinking about it in only Web services terms doesn't do justice to the host of important scenarios that it addresses elsewhere (version-tolerate persistence for any CLR type in any store).

We are defining a common abstract data model for CLR types for N scenarios -- many of which are Web service related.

http://www.douglasp.com/PermaLink.aspx?guid=01095547-b7f1-4e1d-8c4e-31038296f164

If [DataContract] is not just an Indigo feature but a feature for the entire .NET Framework then why couldn’t it become the center point for an O/R Mapping engine?  And if attributes are good enough for defining [ServiceContract], [OperationContract], and [DataContract] why couldn't it also be good enough for defining details to be used by a persistence engine?

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Sunday, June 19, 2005 2:17 PM by Paul Wilson    
I prefer xml mappings because:

1) Persistence is external to my entity objects -- I can and do use my entities differently at times.
2) Makes it easier to change the O/R Mapper I use -- not totally seamless, but easier if pure POCO.
3) Table and field names can and do vary at times -- customers of my apps do have different schemas.
4) Makes it easier to reuse my entity objects -- the same business logic can be used in different ways.
5) Personal preference -- focus on business only -- I just don't see the point of attribute clutter.

How is Indigo different then?

1) The service class typically requires a service.
2) There are not usually multiple service brokers.
3) There is not often a need for multiple versions.
4) The service itself is the means of reuse here.
5) Personal preference -- focus is the service.

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, June 20, 2005 5:29 AM by Alex James    
I have to say I kind of agree with Paul on this one. XML mappings make sense for O/R mappers. Since mappings can change independantly of the rest of the business object. Surely that is the whole point of an O/R mapper?

However in my 'Ideal' world there is something else that encapsulates the mapping for me. For example a Server? So that my client code can use those objects without needing to load a mapping file.

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, June 20, 2005 12:57 PM by Steve    
Yeah, I agree with Paul as well, but I also wonder if there may be reasons that the Indigo team chose to go with an attribute based approach as opposed to a xml configuration approach. I suppose some of Paul's points regarding the differences explains some reasons. I'll need to dig into Indigo more before I can make my own conclusions. Thanks for the thoughts...

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, June 20, 2005 4:42 PM by Alex James    
Steve,

I may be missing something because I've only had a cursory look but I think [DataContract] and [DataMember] are 'what' not 'how'. I.e. It tells us what we need to do, i.e. we need to persist the object and the fields marked with [DataMember] too, it doesn't tell us How. That seems different from O/R Mapping files which are about How. What do you think?

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, June 20, 2005 11:40 PM by Steve    
Alex,
I'm still tring to figure out what exactly [DataContact] and [DataMember] are used for :) My impression from reading over some docs was that they're used to define the "schema" that is shared amount the services ([ServiceContract] & [OperationContract]). I was trying to create a Indigo project on my local machine to have a look at how one might use DataContract and DataMember but I wasn't having any luck. I'll look to try again and report back on what I think.

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Wednesday, June 22, 2005 10:10 PM by Joe    
The OR Mapper I use supports both XML Mappings and Attributes...essentially abstracted which are used. Attributes are good for RAD ... BUT I have noticed that sometimes, particularly when re-use is desired, that you need 'contextual' attributes. By separating how I've implemented the attributes (ie via XML or directly), I can do this.

My current concern for Indigo is that my data contract may in fact be contextual and I'm loathe to implement more than one object.

Perhaps this is more a concern for libraries/re-usable data libraries.

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Thursday, July 07, 2005 1:08 AM by Jeff Perrin    
I started to reply, but it got too big, so it's now a full-fledged post:

http://blog.jeffperrin.com/testosteles/posts/444.aspx

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Sunday, July 10, 2005 8:58 PM by hammett    
Definitely attributes.

ActiveRecord adds attributes sugar and performs the integration with NHibernate - for me its the best of both worlds.

http://www.castleproject.org/index.php/ActiveRecord


# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, April 07, 2008 7:16 PM by Tony    
Jeff Perrin's post is now at: http://www.jeffperrin.com/index.php/2005/07/

# ed hardy

Wednesday, October 28, 2009 11:19 PM by ed hardy    
one day i went shopping outside ,and in an ed hardy store,I found some kinds of ed hardy i love most?they are: ed hardy jeans on sale ed hardy jeans on sale ed hardy jeans sale ed hardy jeans sale cheap ed hardy jeans cheap ed hardy jeans cheap ed hardy jeans on sale cheap ed hardy jeans on sale cheap ed hardy jeans sale cheap ed hardy jeans sale ed hardy jeans for men on sale ed hardy jeans for men on sale discount ed hardy jeans discount ed hardy jeans disconnt ed hardy jeans for men on sale disconnt ed hardy jeans for men on sale good qulity ed hardy jeans for men on sale good qulity ed hardy jeans for men on sale

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Thursday, October 29, 2009 9:29 AM by tiffany jewelry    

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Thursday, October 29, 2009 9:45 AM by tiffany jewelry    

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Thursday, October 29, 2009 9:44 PM by links of london Necklace    

links london Pendants links london Pendants links london Pendants links london Pendants links london Pendants links london Pendants links london Pendants links london Pendants links london Pendants links of london links of london new arrival links of london new arrival links of london new arrival links london new arrival links london new arrival links london links london new arrival links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet links of london Friendship Bracelet

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Saturday, November 21, 2009 9:17 PM by qingpi    
XT Lowest Price replica watches supplier, BREITLING REPLICA offer high-class
replica watches
REPLICA more than 100 famous brands, luxucy replica Piaget watches and swiss watches


We supplies all kinds ofreplica watches
replica watches
and so on. Over 10000 Styles of High ...replica Rolex watches

# Still, A&F as in other whipsawed industr

Monday, November 23, 2009 12:49 AM by af    
Still, A&F as in other whipsawed industries, a few survivors stand to abercrombie benefit from the widespread pain. To figure out who they are abercrombie fitch since the recession began near the end of 2007. Then I researched earnings abercrombie & fitch reports and other sources to separate firms with strong inherent growth from those benefiting from mergers, abercrombie Jeans accounting anomalies, or one-time events. Of 41 firms on Capital IQ's initial list, abercrombie Pants only eight made the final cut. abercrombie Tees All emphasize value, whether it's huge portions or quality for less. abercrombie Shorts And all of these companies are financially healthy, abercrombie Sweaters with reasonable debt and the wherewithal to keep expanding despite a credit crunch. abercrombie Outerwears Here are the restaurants with the right recipe for lean times:It might not be good for America's waistline, abercrombie Hoodies but froufrou dining off petite plates is out. abercrombie Polos The recession has made us hungry for family-size piles of comfort food, abercrombie fitch Jeans skyscraping burgers, abercrombie fitch Pants and all-you-can-eat fries.Like other segments of the retail economy, abercrombie fitch Tees the restaurant industry has struggled over the past two years abercrombie fitch Sweaters as unemployment has soared and consumers have curtailed spending. abercrombie fitch Outerwears The National Restaurant Association's performance index shows that the industry has been shrinking for 23 months in a row. abercrombie fitch Hoodies High-end bistros have fared the worst, with sales at fancy restaurants like Ruth's Chris and Morton's Steakhouse off by 20 percent or more, abercrombie fitch Polos as corporate customers pare expenses and other diners trade down.

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, November 23, 2009 3:20 AM by yoyo    

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Monday, November 23, 2009 3:27 AM by yoyo    

# links of london

Tuesday, November 24, 2009 1:35 AM by links of london    
Chipotle Mexican Grill links of london jewellery . The fast food at these casual links of london eateries feels slow, links london jewelry thanks to organic ingredients cheap links of london , custom combos, link of london and an emphasis on freshness. links of london sale Traffic is down at many locations, links of london jewelry but the company has been able to compensate by raising prices, links london Olive Garden. links of london Charms More food for less money hits the sweet spot these days, links of london Charm which makes the family-style portions at this casual Italian chain a hit with diners. links of london Necklaces Olive Garden is a division of Darden Restaurants, links london Necklace which also operates Red Lobster, links of london Bracelets Longhorn Steakhouse, links london Bracelet and a few smaller chains. links of london Sweetie Bracelets Olive Garden has been the best performer of the bunch, links london Sweetie Bracelet with same-store sales down slightly but overall sales up, links of london Friendship Bracelets thanks to about 35 new outlets links of london Sweetie Watches that have opened over the past year links london Friendship Bracelet

# timberland boots,timberland shoes,timberland mens boots ,cheap timberland boots, timberland womens b

Tuesday, November 24, 2009 8:39 AM by timberland womens shoes    

Power invariably means both timberland on sale responsibility and cheap timberland boots danger . If your Riches are yours classic timberland boots , why don't you take timberland womens shoes them with mens timberland boots you to the other world ? Money is a good discount timberland boots servant and a bad timberland winter boots master . Money is like muck , not good except it be spread . No country , however rich , can afford the waste of its human resources . Sometimes one timberland store pays most for the things one gets for nothing .


# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Thursday, November 26, 2009 10:29 PM by abercrombie Jeans    
"Climate change links of london Necklaces needs to be addressed now. The poor will bear the brunt of the impacts. The frontline experience of many of us ed hardy bags working in international development indicates that communities are having to combat more extreme links london Necklace weather conditions." Climate ed hardy sunglasses change will play havoc with agriculture and water supplies and will increase diseases. "By 2025 the ed hardy purses proportion of the world's population living in countries of significant water stress will almost links of london friendship bracelets double, to 6 billion people. Tropical and ed hardy t shirts sub-tropical areas will be hardest abercrombie Polos hit - those countries already suffering from food insecurity".

# re: The next great O/R Mapper...ADO.NET?

Friday, November 27, 2009 4:21 AM by Aion Kina    
20947183369175745 In other words, Last Chaos Gold in addition Replica Cartier Watches to the original Replica Rolex Watches game, Final Replica Watch Fantasy XI Ultimate Replica Chanel Watches Collection will Replica Swiss Watches include the expansion Rise of Replica Breitling Watches the Zilar, Chains of Promathia, Treasures of Replica Watches Aht Urhgan and Wings of Replica IWC Watch the Goddess. In Dvd Box Sets addition, scenarios A Crystalline Replica Montblanc Watches Prophecy – Bestowing Ode of Life, A Moogle Kupo State – Evil in Swiss Replica Watches Small Doses and A Replica Breguet Watches Shantotto Ascension Tag Heuer Replica Watch – The Legend Torn, Her empire Born Replica BRM Watches will be present.

# re: If Attributes are good enough for Indigo why aren't they good enough for O/R Mappers?

Friday, November 27, 2009 6:32 AM by Ed Hardy    
Find a great range of Ed Hardy products. Ed Hardy Women's Ellerise Lowrise Sneaker · Ed Hardy Women's
thanks for your post.perhaps you will like
Ed Hardy
Ed Hardy handbags
cheap Ed Hardy
Ed Hardy clothes
Ed Hardy
Ed Hardy Clothing Shoes and Accessories On Sale,Official Ed Hardy Store for all Clothing and Gear,ed hardy swimwear,ed hardy Shoes.Ed Hardy shoes
Ed Hardy clothes
The Best Ed Hardy Online Store, supplying Cheap Ed Hardy shirts, Swimwears, Tanks, Bags and so on for women and men. Enjoy your ed hardy shopping experience here