Login
BLOGs    August 1, 2010
Categories
 
 
 
Search
 
 
 
Archive
 
 
 
Latest Blog Entries
 
Jun9

Written by:Renato.Eccher
6/9/2009 4:43 AM 

As a believer in model-driven design, I got excited when Entity Framework released the new capability of using the model designer to design your domain model first. As a second step, it allows you then to create the database schema. So, needless to say I jumped into it and tried it out. My enthusiasm got a damper when I realized that the Beta version has still some serious problems. Nevertheless, I think it is the right way to go.

 I started with a simple domain object with one business attribute and two system attributes:

Business attributes:
Name: a simple string that holds a name for each instance.of the class.

System attributes:
SysId and SysVer are system attributes that are not supposed to be used in business logic. Both attributes are read-only and are used by the EF only.

SysId: in good oo-practice every instance of a class has a unique identifier; so the type is Guid. Since it is the key column of the database table and I want EF to take care of it, the value for 'StoreGeneratedPattern' is set to 'Identity' which will auto-generated a new unique value for every newly inserted entity to the database.


SysVer: system version is a timestamp that is used for concurrency control. As per EF documentation, the value for 'StooreGeneratedPattern' is 'Computed' and the value for 'ConcurrencyMode' is set to 'Fixed'.
'Computed' means that whenever EF does an insert or an update it will generate a new value. In addition, EF will feed the generated value back into the entity after both inserts and updates.
'Fixed' means that the original value of this property is sent as part of the 'where' clause in all updates or deletes; preventing any dirty writes from happening.


Once I defined my new domain object, I needed to create the database table scripts. But, using the EF wizard ‘Generate Database Script from Model..’, I got  a little surprise:

Error: 'The given key was not present in the dictionary'. I assume that this tells us that some of the attribute settings are not implemented yet and I hope that the Microsoft team will have resolved these issues in their next release of EF.

I am waiting for an answer and might think of a work-around in the mean-time.
 

Tags:

4 comment(s) so far...

Re: Entity Framework: First (unsuccessful) step with a 'Model Driven' design approach

thanks for the article. It was very ineresting for me.
www.rapidsharemix.com

By Lilianna on  12/18/2009 9:05 AM

Re: Entity Framework: First (unsuccessful) step with a 'Model Driven' design approach

thanks for the article

By Shared Web Hosting on  12/20/2009 4:06 PM

Re: Entity Framework: First (unsuccessful) step with a 'Model Driven' design approach

It was very ineresting for me.Thanks

By Love poetry on  1/17/2010 9:54 AM

Re: Entity Framework: First (unsuccessful) step with a 'Model Driven' design approach

I Have same problem and i waiting too

By Hassan on  3/29/2010 12:58 AM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
 
 
 Copyright 2009-10 by EccoDynamics  Terms Of Use Privacy Statement