Tag | Entity Framework Posts

In almost every talk I have done on Entity Framework I get questions on how to do custom SSDL or SQL when using model first development. Quite a few of these questions have required custom changes to the SSDL, which of course can be a problem if it is getting auto generated. Luckily, there is a tool that can help. In the Visual Studio Gallery on MSDN, there is the Entity Designer Database Generation Power Pack. You have the ability to select different generation strategies and it also allows you ...
One of the powerful things that has come into Visual Studio over the last few years has been joy of extensions. With 2010 there seems to be even more!! Of course teaching old dogs like myself new tricks always takes time but interestingly enough some of the rules I learnt early in my working life over 30 years ago still hold true!! A derivation of one that was knocked into during my engineering apprenticeship and associated exams was RTFQ! Read the ‘flippin’ question. (I replaced the original ‘F’ ...
Now I’m not an expert in either of these techs. I have a nice framework for unit of work / repository built with NHibernate. Works pretty well. I use FluentNhibernate to do the mappings. Works well. Takes very little code to get going with a DB back OO model. So why swap? Linq. In Entity Framework you get much better linq support. Visibility. I have no idea what's really happening with NHibernate….its a cloud of mystery most of the time. You have to read all the blogs, mailing lists, etc to know ...
The previous posts on Entity framework are available here : Entity Framework version 1- Brief Synopsis and Tips – Part 1 Entity Framework v1 … Brief Synopsis and Tips – Part 2 General Tips on Entity Framework v1 & Linq to Entities: ToTraceString() If you need to know the underlying SQL that the EF generates for a Linq To Entities query, then use the ToTraceString() method of the ObjectQuery class. (or use LINQPAD) Note that you need to cast the LINQToEntities query to ObjectQuery before calling ...
Alex (http://simpleisbest.co.uk/) does a very good job in covering the new features of .NET 4.0 and Visual Studio 2010. His focus is on the developers that have experience in development using previous versions of Visual Studio, more specifically Visual Studio 2008. The following are my views towards his book. 1. Scope / Coverage Even as the book is labeled as introduction, it is covers a broad spectrum of technologies, features and references that are focused into helping a developer quickly decide ...
The Entity Framework has been valuable to me since it came out, because it provided a convenient and powerful way to model against my data source in a consistent way. The first versions had some deficiencies that for me mostly fell in the category of the tight coupling between the model and its resulting object classes (entities). Version 4 of the Entity Framework pretty much solves this with the support of T4 templates that allow you to implement your entities as self-tracking entities, plain old ...
Using Entity Framework with ASMX Web Services and WCF Web Service: If you use ASMX WebService to expose Entity objects from Entity Framework... then the ASMX Webservice does not include object graphs, one work around is to use Facade pattern or to use WCF Service. The other important aspect of using ASMX Web Services along with Entity Framework is that the ASMX Client is not aware of the existence of EF v1 since the client solely deals with C# objects (not EntityObjects or ObjectContext). Since the ...
There are many instances we might have to use transactions to maintain data consistency. With Entity Framework, it is a little different conceptually. Case 1 – Transaction b/w multiple SaveChanges(): here if you just use a transaction scope, then Entity Framework (EF) will use distributed transactions instead of local transactions. The reason is that, EF closes and opens the connection when ever required only, which means, it used 2 different connections for different SaveChanges() calls. To resolve ...
I have been working on a few client app projects in my spare time that need to persist small amounts of data and have been looking for an easy to use embedded database. I really like db4o but I'm not wanting to open source this particular project so it was not an option. Then I remembered that there was an ADO.NET provider for sqlite. Being a fan of sqlite in general, I downloaded it and gave it an install. The installer added tooling support for both Visual Studio 2008 & 2010 which is nice because ...
FredNUG is pleased to announce that we have an excellent speaker lined up for April. On April 20th, we’ll start with pizza and social networking at 6:30 PM. Then, starting at 7 PM, Dane Morgridge will present “Getting Started with Entity Framework 4” The scheduled agenda is: 6:30 PM - 7:00 PM - Pizza/Social Networking/Announcements 7:00 PM - 8:30 PM - Main Topic: Getting Started with Entity Framework 4 with Dane Morgridge Main Topic Description: Getting Started with Entity Framework 4 With .Net 3.5 ...
Time for another guest post (check out others in the series), this time bringing together the world of mocking with the world of Entity Framework. A big thanks to Moses for agreeing to do this. Unit Testing Entity Framework Dependent Code using TypeMock Isolator by Muhammad Mosa Introduction Unit testing data access code in my opinion is a challenging thing. Let us consider unit tests and integration tests. In integration tests you are allowed to have environmental dependencies such as a physical ...
While I was working on a SilverLight 4 demo I found out that Entity Framework is not supported directly through the .NET provider or ODP tools. In order to make them work you need to either write a wrapper of your own (wouldn't chance it) or else use a provider like DataDirect or Quest's upcoming tool. So far, I've been very happy with the DataDirect tool (found here http://www.datadirect.com/p... As I get a little farther along I'll post more on SL4, RIA, and EF ...
Last week (March 2010) I presented on Entity Framework 4 and the Windows Azure Platform at www.devweek.com. As usual, it was a great conference and I caught up with lots of old friends and made some new ones along the way. Entity Framework 4 Entity Framework 4 In Microsoft Visual Studio 2010 View more presentations from Eric Nelson. Windows Azure and SQL Azure Building An Application For Windows Azure And Sql Azure View more presentations from Eric Nelson. Entity Framework 4 Related Links Poll on ...
The new release of Employee Info Starter Kit contains lots of exciting features available in Visual Studio 2010 and .NET 4.0. To get started with the new version, you will need less than 5 minutes. Minimum System Requirements Before getting started, please make sure you have installed Visual Studio 2010 RC (or higher) and Sql Server 2005 Express edition (or higher installed on your machine. Running the Starter Kit for First Time 1. Download the starter kit 4.0.0 version form here and extract it. ...
Employee Info Starter Kit is a ASP.NET based web application, which includes very simple user requirements, where we can create, read, update and delete (crud) the employee info of a company. Based on just a database table, it explores and solves most of the major problems in web development architectural space. This open source starter kit extensively uses major features available in latest Visual Studio, ASP.NET and Sql Server to make robust, scalable, secured and maintainable web applications ...
12 months back (today is March 15th 2010) on the 16th of March 2009 I created a poll on Entity Framework v1 – the marmite of ORMs? A quick poll…. Entity Framework v1 was getting a mixed reception at the time – I met developers who genuinely hated it and I met developers who were loving the productivity improvements they were seeing. There were definitely issues with v1, too many IMHO. Which is why the product team placed a huge effort on listening to the community to drive the feature set for v2 ...
[UPDATED 23/3/2010 with two new links from developmentor on STEs] I just posted on the bits you need to install to explore all the features of Entity Framework 4 with the Visual Studio 2010 RC. I’ve also had a quick look (March 12th 2010) to see what new resources are out there on EF4. They appear a little thin on the ground – but there are some gems. The following all caught my attention: Julie Lerman has published 2 How-to-videos on EF4 on pluralsight.com. You need to create a free guest pass to ...
Next week (17th March 2010) I am presenting on EF4 at www.devweek.com in London (and Azure on the 18th). Today I wanted to get all the latest bits on my demo machine and also check if there are any cool new resources I can point people at. Whilst most of the new improvements in Entity Framework come with the Visual Studio 2010 RC (and the RTM), there are a couple of separate items you need to install if you want to explore all the features. To demo EF4 you need: Visual Studio 2010 RC Download and ...
Every so often I Wordle my delicious account to see “where I’m at”. This is a spookily accurate depiction of my online life at the moment :-) Therefore… Related Links: UK Azure Online Community – UK Online community for Azure fans http://www.eurogamer.net/ My favourite online fix for gaming news http://badcompanytwo.com/ My next Xbox 360 game – should keep me busy for many months http://bit.ly/ef4resources All the best Entity Framework resource links in one place :-) ...
Just a brief note about events where you can expect to see me over the next few months in the UK (and TBH this post will be helpful reminder to me!) February DotNetDevNet - Thursday 25th February 2010 – talking Windows Azure and SQL Azure Azure Open Space Coding Day Feb 27th – coding on Azure March Qcon London 2010 March 11th – manning the Interop stand CloudCamp London March 11th – just being nice to people :) Cloud Computing Congress March 16th – talking on Azure DevWeek March 17th and 18th – talking ...
While I was on holiday last week we announced Tech Days. Tech Days is shaping up to be something rather good. It is a week-long series of free events run by Microsoft and technical communities to “Celebrate and inspire developers, IT professionals and IT Managers to get more from Microsoft technology” You can attend for 1 day or all 5 days. You can just attend the developer days or mix it up with the IT Pro days. It is entirely up to you. I will be doing my bit delivering sessions on Azure, Entity ...
On Monday 15th Feb 2010 I gave an overview session on Entity Framework 4 for the Developers Group. A big thanks to those who attended and asked great questions. My slide deck from the session: Entity Framework 4 In Microsoft Visual Studio 2010 View more presentations from ericnelson. A related set of screenshots from the demos I gave (or at least, a similar set of demos I did in Oct 2009): Dev305 Entity Framework 4 Emergency Slides View more presentations from ericnelson. Related Links: 101 EF4 Resources ...
I did a session yesterday on Entity Framework 4 using Visual Studio 2010 RC. Unfortunately VS2010 crashed on me 4 or 5 times during my presentation whilst editing code (I resolved it by copy and paste from Notepad!). I was pretty convinced the issue was related in some weird way to the amount of other beta stuff I have on my machine plus a history of various CTP installs of VS2010. However it turns out there is a more fundamental problem with Intellisense in the release candidate. The good news is ...
Just getting a few interesting cloud links “down on paper”. I last did one of these on Azure in Dec 2009. Not everyone seems to know that Roger Jennings does a rocking job of collating links on Azure – e.g. Sunday Feb 14th. Recommended read - Using SQL Server Client APIs with SQL Azure Version 1.0 Q&A: Looking Ahead at Microsoft's Cloud Strategy Tim O'Brien, director of Microsoft's Platform Strategy Group, discusses the future of Windows Azure, Silverlight, and developing with .NET. Getting MySQL ...
I normally use an int with an identity as the primary key for most tables in Sql Server and I think that is probably the normal habit of most developers, but on occasion, you will need to use a unique identifier, which maps to a System.Guid in code. I am not going to go into the pros/cons of using a Guid as your primary key, as there is much debate around this. I am currently working on a project where this is required and I also use Entity Framework 4 and ran in a snag almost immediately. Entity ...
Yesterday I did a MSDN geekSpeak on Persistence Ignorance with Entity Framework 4. The recording is now up on Channel 9 and I have a link to the demos below: Recorded webcast geekSpeak Demo Code A special thanks to Glen Gordan and Dani Diaz for hosting this geekSpeak and asking me to come on as a guest. I had a blast! As I mention in the webcast you can hit me up from my contact form on here or catch me on twitter if you have any questions ...
Had a strange error come up today when I tried to use my home PC to run an Entity Framework project, the EDMX schema (is it a schema) was generated in SQL Server 2008 and my home dev machine has SQL Server 2005. I wouldn't have thought this would be a problem as I don't use any 2008 specific features (except the intellisense ;P), but alas I was getting a lot of exceptions from my FunctionImports (stored proceedures in Entity Framework). Upon investigating the stack trace it was telling me that the ...
I came across and found very useful, bare in mind I am relatively new to the EF and TDD so any suggestions would be welcomed. I have been very busy recently with a new project, as I am in control of this project I have wanted to do things correctly from the start, I also am using it as an opportunity to get familiar with all the newest and shiniest of Microsoft's technologies. The platform is using a combination of ASP.Net MVC 2.0 and the Entity Framework 3.0. Because I know this codebase is going ...
Persistence ignorance is, I believe, one of the most important features of an ORM tool and it is coming with Entity Framework 4 and Visual Studio 2010. When your classes are persistence ignorant, they don't know anything about the data layer they are attached to and carry no dependency to said data layer. Any application where your data will be passed between layers, like in a web service or web application, will greatly benefit from an ignorant set of data classes. This was possible with Entity ...
Tech bloggers like to have a predictions post at the beginning of each year (or the end of the previous one). I’ve never actually written one before, although I have made year-ahead predictions in panel discussions for the now defunct NYSIA. Since there’s no panel this year, and since I’m taking better care of this blog, I’d thought I’d give clairvoyance a whirl right here. The following predictions are pretty random and probably not comprehensive, but I’m making it my new year’s resolution to prevent ...
Merry Christmas from Silverlight Cream! In this Christmas Eve in Phoenix Issue: Cristian Merighi, Jeff Blankenburg, András Velvárt, Jeff Prosise, Micah, Sean Blakemore, Expression Blog, Andrej Tozon, CrocusGirl, Adam Kinney, Jordan Knight, and Jonas Follesø(2). Shoutouts: It appears Adam Kinney had access to a few more Silverlight Christmas cards than I did: Silverlight Christmas Cards for 2009 Martin Grayson announced Blacklight v4.3(Dec09) released Jafar Husain has two entries at Channel 9 on Silverlight ...
This is a continuation of my last post That is testability, not Test Driven Development. In it, I analyzed an article on the ADO.Net team blog Walkthrough: Test-Driven Development with the Entity Framework 4.0. I wanted to take that analysis a step further and share some insight from the testing perspective itself. There are two tests to review to produce a list of testing tips. Update: Some of these test refactorings won’t work in the existing sample as they take dependencies to NUnit, you will ...
I applaud efforts to encourage test driven development, however I find myself cringing at the examples being produced by the framework designers we are supposed to look up to. I've noticed this with the buzz around TDD and ASP.Net MVC and now that buzz is transferring to the Entity Framework. I think it is wonderful that these frameworks are designed with testability in mind. However, it is up to the developer to actually employ TDD when composing their applications. There are other ways to test, ...
[Updated 23/12/2009: You might also want to check out my colleagues Mike and Mike who did the same] For fun I thought I would have a look at which of my posts in 2009 were my most popular. The results were quite surprising. By number of pageviews (which tends to favour 1st half of year): Entity Framework 4.0 Resources – documentation links, best blog posts and more: Posted in September and also known as 101 links on Entity Framework 4.0. Received a large update in December. 5% of my traffic! How ...
If you have used the Entity Framework that shipped with Visual Studio 2008 SP1, you would really start appreciating the flexibility it offers for building schema driven data access layer and get it to the UI Layer either directly or using a middle tier such as WCF RIA Service. Check my earlier post on this, if you are interested further :) Meanwhile, the other exciting stuff that has been around is the SQL Azure which is part of the Windows Azure platform. SQL Azure provides relational data over ...
The next version of Entity Framework has many new features, many of which are enabling it to catch up with features previously available in other frameworks like LINQ to SQL. One of these new features is the updated stored procedure support. In previous versions of EF, working with stored procedures was quite limited and really only usable with CRUD operations that were mapped to already defined entities. With EF 4, you can start with your stored procedure and have the designer automatically generate ...
I have just completed a first round of updates to my popular blog post from September Entity Framework 4.0 Resources – documentation links, best blog posts and more Pop a comment here or better still in the main post if I missed something cool! (Which no doubt I have) The following were added: Overview blog posts/articles What’s New in Entity Framework 4, Part 2: Modeling Changes (Nov/Dec 2009) Renovations to .NET 4.0's Entity Framework (Nov 2009) Entity Sequel (Dec 2009) 5 Steps to having a great ...
I have been playing with the WCF RIA Services (erstwhile .NET RIA Services) for sometime and found that most of the samples out there focus on Silverlight based applications. While the new WCF RIA Services preview for VS 2010 is awesome in terms of its Silverlight integration, I also wanted to test out on building plain vanilla ASP.NET Applications and using the power of WCF RIA Services to build a middle tier for the same. Ok, to begin with, I already had Visual Studio 2010 Beta 2 installed and ...
This podcast was recorded at TechEd Europe in November 2009. I get a chance to sit down with Mike Flasko, Program Manager in the Data Services team. We had both presented on Entity Framework during the conference which is where we started the discussion before we moved on to talk about Data Servies and some of the announcements around Data Services, RIA and WCF which would be happening the following week at PDC. Definitely worth a listen (IMHO). Listen/Subscribe: Download/Play MSDN Flash Show 014 ...
I was giving an Entity Framework talk in Harrisburg, PA at the Central Penn Code Camp earlier today and afterwards I was talking with one of the developers that attended my session. He was a little hesitant to use Entity Framework because he didn't want to use it solely as his data layer. I explained that you don't have to use it directly as your data layer but could add another layer of abstraction. This is actually how I use Entity Framework almost exclusively. In short, how I do this is I build ...
Step 1 Install Visual Studio 2010 Beta 2 http://bit.ly/vs2010b2 TIP: This works great inside Windows Virtual PC (10MB download) on Windows 7 if you want to avoid using it on your main machine Step 2 Install ADO.NET Entity Framework Feature Community Technology Preview 2 http://bit.ly/ef4ctp2 TIP: The CTPs give you additional functionality such as self tracking entities – which you need for N-Tier work Step 3 Install the beta of LINQPad for VS2010 Beta 2 http://linqpad.net/Beta.aspx TIP: I recommend ...
Last night (3rd Dec 2009) I was lucky enough to be speaking at my local (and most excellent) user group http://www.dotnetdevnet.com/. There were plenty of mince pies and lots and lots of swag to give away – plus great questions and chats in the breaks. Thoroughly enjoyed it. Slides: Entity Framework 4 In Microsoft Visual Studio 2010 - ericnel View more presentations from ukdpe. Links from the session: Install VS2010 Beta 2 http://bit.ly/vs2010b2 LINQPAD beta for Visual Studio 2010 Beta 2 http://linqpad.net/Beta.aspx ...
With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework. The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to ...
It is already December 3rd, we have 4 trees up around the house (courtesy of the local woods and a recent storm) and tonight I will be presenting on Entity Framework 4 at the Christmas meeting of the Bristol .NET Developer Network user group (Just noticed session is full – I had best check my demos next!). Which lead me to do two things: 1. Gather up as many developer books as I could find to give away this evening – i found a lot! 2. Decorate the team logo (original art work by the talented DeepFat ...
I am a huge fan of code reuse, as any good developer would be, but there it the tendency at times to write "near-duplicated" code. Near-duplicated code is when you have a function, like a database save or delete, that is rewritten multiple times, but with small, but seemingly important differences. There are many times where those "seemingly important" differences can be easily abstracted away. For example, I can write a Save method in the Entity Framework as follows: 1: public Person SavePerson(Person ...
c# 3.0 : Partial Method You are all aware of “Partial Class” introduced in .net 2.0. Partial class is useful in situation where you need to split the definition of a class, struct or an interface over two or more source files. Each source file contains a section of the type or method definition and all parts are combined when the application is compiled. There are several situations when splitting a class definition is desirable: When working on large projects, spreading a class over separate files ...
[This is the fifth in a series of posts on getting started with the new features in Entity Framework 4 based on the demos I did in my session at TechEd Europe in Berlin last week (Nov 2009).] Entity Framework v1 did not support a commonly implemented ORM feature called Lazy Loading. Entity Framework 4 adds that feature. In Beta 1 it was known (confusingly IMHO) as Deferred Loading. In Beta 2 it is (thankfully IMHO) known as Lazy Loading. You run up against the absence of Lazy Loading in v1 when you ...
[I haven’t done QandAs for a long while – very remiss of me.] Anyway, I have been asked this one so many times lately that I felt a more public answer was needed. The short answer is: Mostly. Certainly it is good enough to get work done. The longer answer is below… History In the first version of Entity Framework (which came with .NET Framework 3.5 SP1), the Entity Framework Designer was… bad. I mean very bad. I mean dumbly bad. We had a decent enough runtime but the design surface just wasn’t up ...
[This is the fourth in a series of posts on getting started with the new features in Entity Framework 4 based on the demos I did in my session at TechEd Europe in Berlin last week (Nov 2009).] Complex Types make it easier to work with objects, allowing the grouping of related properties in Entities and the reuse of these groupings across Entities. The first release of Entity Framework included Complex Type support but did not expose this capability through the Entity Data Model Designer. The good ...
Last saturday (yep..., even in the weekends the .NET community is active) I presented a talk on Entity Framework 4.0 for CodeCamp.NL. This was organized by the Dutch .NET communities www.sdn.nl, www.vbcentral.nl and www.dotned.nl. You can find my presentation and code examples (VS2010 beta2) on http://www.codecamp.nl/Defa... ...