Get EF 4.1 RC here.
They fixed a whole ton of stuff. What little remains will be done by RTM next month.
And if you want to try it, and keep the methods you used with nhibernate, try the following.
Don’t define a concrete inheritence from DbContext in your persistence library. Just the repository implementations and class maps.
Add the following to global.asax and pass the method to your IoC container as a factory method:
public static DbContext BuildContext()
string providerInvariantName = "System.Data.SqlClient";
string providerManifestToken = "2008";
string nameOrConnectionString = "DomainContext";
var providerInfo = new DbProviderInfo(providerInvariantName, providerManifestToken);
var modelBuilder = new DbModelBuilder();
var model = modelBuilder.Build(providerInfo);
return new DbContext(nameOrConnectionString, model.Compile());
I think I will be waiting for the RTM release. It is looking pretty good though. I am very rarely coding .net these days. Spend all my time lately on iOS and Android applications. Objective-C and Java respectively.
It is actually ridiculous how spoiled we are with Visual Studio. After a few months I have discovered that Eclipse and Xcode suck so much! lol
I know! It’s so true. I’d really like to get into iOS apps but I’m going to wait until I can do it in Visual Studio.
You can – it’s called monotouch.
Tried to use EF code first for a very simple thing – literally a one-page signup form with ~30 fields. After the 2nd WTF (unbounded text fields map to NVARCHAR(128)???) I gave up and went back to good old fashioned ADO.NET.
I looked into that before and from what I understand you need a Mac so I discounted it altogether.
If it could emulate the target device as well as compile for it then it would make more sense. I could be wrong about the whole thing though, does it actually run in Visual Studio?
It lets you write your droid or iOS software in C# which then compiles as a native app. I’d guess you can at least write parts in VS, though you will definitely need a mac to do iOS stuff as it is still compiling objective-c at the end of the day.
It would probably be just as well for me to learn Objective-C. Blah. I looked at it before and it makes me pine for the fjords of C#.
I swear, people give Microsoft crap all the time, especially the Linux/PHP folks. Yet, at the same time, iHype Corp is far more closed-source then M$, as the Kool-Aid drinkers would say. Hypocrites if you ask me. I would never by a $10,000 iHype computer, just to build apps for a falling market-share, know as an IPhone. At least with Android I can use an economical PC and an actually good programming language.