I have a data layer built on Linq-2-SQL in .net 3.5. We're looking at migrating to .Net 4. soonish. When we started the original development I was interested in using EF for the data layer, but found it wasn't really an option in .Net 3.5. Now that we're upgrading, I'm thinking it over again.
I realise that L2S is still supported in .Net4, however I would be keen to switch to the more active area of development for the future proofing of a system that's likely to be core to the business for a fair while. (My understanding is based on statements such as "We said we would improve the core of it (L2S) and add customer requests where it makes sense but that Entity Framework would be the primary focus." from Damien Guard in the comments to this post.
What complicates it a bit is that we have made a few mods to our L2S implementation:
Most of the rest of what we use I know will be ok because I've done it myself in EF4 (in fact a lot of it started life on an EF4 database), but I wanted to know if the above customizations are going to be problems.
So:
NB: If we used EF I would probably use the Database First version.
Can we still have a customized .tt type generating system (or something similar)?
Yes. In VS 2012 you can use a DbContext
generator which uses a T4 template to generate your DbContext
and persistence-ignorant classes.
Once you add it and point it to your edmx file, you can modify the templates all you want to customize the output.
If you're using VS.NET 2010, then you can install the EF 5.x DbContext Generator for C# extension from the Visual Studio Gallery to install the template generator and have it added to the "Add Item" menu in VS.NET.
Can we still use our own defined sprocs for CRUD?
Yes, it's simply a matter of mapping the conceptual model (what you work with in the edmx files) to the physical model (the representation of the database). In the mapping, you'd specify the stored procedure instead of having it done dynamically.
Julie Lerman goes into detail on how to map your CRUD operations to stored procedures in the section of the MSDN documentation titled "Stored Procedures in the Entity Framework".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With