c# - Working with GUIDs and Entity Framework -
Highlights that you can not use the server side build GUID with the structure of the unit but, I want to The generation of Gwaid should be handled at the DAL level of the database API (i.e., when the constructor of an entity is called, I want to start the unit ID on a new GUID). My plan is to write a small device to create a group of code files of partial class of entities. I have one way of doing this, the question is: Am I out of my mind to do this way or should I do it the way I should?
My problem is, when the edmx file has been updated, I do not want to edit a bunch of code files, I will only run one tool which is necessary.
Again, is my head straight?
OK if you see partial organs, the unit framework is generated by default, a default constructor Does not happen.
Doing this will work well in a different partial classroom:
public partial class customer {public customer () {_ID = Guid.NewGuid (); }}
So there is probably no such reason as you are planning.
You may however want to do so in T4 templates to do this. Similarly, EF 4.0 (ie NET.NET 4.0) allows you to customize the generated code. Now, while this experience in 4.0 seems quite a lot, you can easily add something together on the basis of T4, just to make this partial classes that work fine in .NET 3.5 SP1.
Hope this helps
Alex
Comments
Post a Comment