Julia Lerman's Blog, page 22
November 21, 2011
Programming Entity Framework 2nd Edition vs Code First Edition
I've had tweets and emails from readers asking if there is any point to reading the 2nd edition of Programming Entity Framework if they are only planning to use Code First and DbContext.
(Before answering, I want to add a disclaimer that my response is not geared towards my desire to increase royalties in order to pay off my mortgage someday. That wouldn't be possible unless I put Harry Potter or Steve Jobs names on the cover. Hey, now there's an idea!
)
Yes, the 2nd edition is completely relevant although there are bits within there that will be irrelevant.
Getting your hands on the book(s):2nd edition
You can get print & ebooks (PDF/mobi (for Kindle) etc) directly from the publisher here
Amazon –> Print Print version Kindle: Kindle Version
Plenty of other sources as wellCode First
Ebook is available today (Nov 21, 2011) with print coming soon here
Kindle should be available by Wednesday (Nov 23, 2011) on Amazon.com with print coming shortly after that: direct link to Amazon page
To begin with, I suggest reading this blog post about the difference between what's in Code First/DbContext and the core EF APIs that are part of .NET 4 (Code First and DbContext are now "The Entity Framework").
The CF book (Programming Entity Framework: Code First edition) is a relatively short book (175 pp) that covers how Code First enables you to create an entity data model that Entity Framework can use directly from your domain classes. It explains how Code First works by convention and how to use the Data Annotations and Fluent API to configure the model when convention don't interpret your classes as you intended. the book also goes into detail on how Code First "database initialization" feature works and how to control it. In one of the final chapters, we cover some advanced features of Code First.
That's the entirety of the book. So what it's doing is showing you how to achieve a model without the designer, replacing only a very small part of what you learn in the 900 page book (the part it replaces is how to achieve a model using the designer). Even in the 2nd edition chapters that cover advanced modeling, you learn more than just how to click here and type there in the designer. You get a thorough education on the effects. For example, you'll learn how to build inheritance into your model in the designer, but then you'll look at (or write if you want) code that uses this inheritance hierarchy and helps you understand how it works, the affect on your application and on your data. In the Code First book, you'll learn how to achieve the same inheritance hierarchies using code first (convention, annotations and fluent) but we do not spend very much time on how this affects your applications.
The book we are writing right now will focus on the DbContext API including the new state management and Validation API. This will also be narrowly focused. DbContext gives you easier access to the most common coding patterns that are a little trickier to achieve with the underlying ObjectContext. A great example is that in Chapter 21 of 2nd edition, I have some extension methods to make it easier to get to tracked objects. DbContext now has the Local method so you won't need those. The underlying behavior of EF does not change.
We were avoiding writing another book that might end up at 1200 pages (and take forever to write) were we to include all of the information in once place. Instead, the goal was to give you the specific information that was missing in as short and digestible a format as we could. The short books may be all you want. If you are interested in the deeper aspects of how EF works, how to control it, how to deal with exceptions, performance, transactions, application patterns etc etc, then you can learn those things in the 2nd edition.
When the DbContext book is finished, our plan is to put together a cook book of application DbContext for use with DbContext & Code First that are relevant to those you'll find with ObjectContext and EDMX (POCOs & EntityObjects) in the 2nd edition.
I hope this will help you with your journey.
Programming Entity Framework: Code First edition is now available as an ebook!
OReilly Media pushed the ebook versions (PDF, mobi (for kindle) & others) of Programming Entity Framework Code First live this morning! You can get it at http://shop.oreilly.com/product/0636920022220.do. The print version should be available soon. Print is also available for pre-order on the OReilly site as well as on Amazon at http://juliel.me/ufZtlb. Amazon should have the kindle version available shortly. On twitter, Shawn Wildermuth said "I'll get it when the Kindle version ships..tech books on a Kindle Fire are really good so far".
November 9, 2011
New Entity Framework Book(s) Status
I've added a post on the website for my book detailing the current status of the new Code First edition and the upcoming DbContext edition for anyone who is interested: new book(s) status
October 23, 2011
We Have a Book Cover!
Although I did see early versions, I just happened to notice that the O'Reilly Media page for the new book (Programming Entity Framework Code First) now has the book cover image on it.
October 21, 2011
Code First and DbContext are now "The Entity Framework"
In the recent blog post, How We Talk about EF and its Future Versions, the EF team announced that going forward, the stuff of EF that’s in .NET, will be referred to as the EF Core Libraries. For example, .NET 4 contains EF 4…that’s now core libraries. When .NET 4.5 is released, whatever is contained within System.Data.Entity.dll will be EF 4.5 Core Libraries.
As you may know by now, Code First and DbContext were released out of band of the .NET release schedule and is contained in the EntityFramework.dll assembly which is distributed via Nuget. Code First and DbContext rely on the core libraries to do their job. In the blog post, the team says “we are going to focus on the EntityFramework NuGet package as the primary deliverable that we refer to as “The Entity Framework” or “EF”.
This allows the team to be more flexible in releasing new features that leverage all of the work that’s gone into Entity Framework – features such as Code First and the DbContext API.
(For anyone writing or blogging etc about EF, please keep these differences in mind and be attentive to how you express EF.)
However, there’s something more important that I took away from the team’s blog post based on the fact that what’s in the NuGet package (DbContext and Code First) is what the team now refers to as “Entity Framework”.
What this means to me is that DbContext and Code First are the first features you should consider when approaching Entity Framework.
This makes a lot of sense to me. DbContext is much simpler to use than ObjectContext and will serve the most common development needs. if you need more, you can drop down into the ObjectContext. Remember that DbContext sits on top of the ObjectContext. The ObjectContext is always there in the background doing it’s work. So if you need to do something very granular, DbContext provides a hook to its underlying ObjectContext. Check out this blog post for how to do that: Accessing ObjectContext Features from EF 4.1 DbContext. Or, if you are already committed to working directly with the ObjectContext, you can still do that.
What about database first and model first? The designer is still inside of Visual Studio (and getting improvements) and there are 3rd party designers as well. If Code First doesn’t do the trick for you, you really want a visual model -- or you’re already committed to EDMX -- no worries. The feature is still there and you will not be a pariah for using the designer. Use the best tool for the job … for *your* job! (Here's an article I wrote about choosing between db/model & code first)
The core EF Libraries know how to use the XML based metadata that come from the EDMX. At runtime, EF uses an in-memory representation of your model. If your model is expressed in XML (from the designer), the ObjectContext knows how to read the XML to create what it needs at runtime. (Even if you’re using DbContext + EDMX, this works…because DbContext has an ObjectContext behind it). If your model is expressed in classes plus Code First configurations, the context knows how to use those pieces to build the in-memory metadata at runtime. After that, EF doesn’t care where the model came from.
So the primary focus of Entity Framework going forward will be building models with your classes plus Code First and managing your entities with the DbContext. When the team talks about Entity Framework, (according to their blog post) that’s most likely what they’ll be referring to.
There’s ANOTHER take away here. Code First leverages the POCO support that was built into the core in .NET 4. (see what I just did there? ) EntityObject is now the ugly step-child of Entity Framework. After working mostly with POCOs in EF for over a year now, I feel the same way about EntityObject. No love lost there!
When the team makes changes to how the core EF libraries (those which are part of .NET), again …popular examples are upcoming enum support and spatial data support … they’ll be clear that this is part of the core. Changes to the core benefit all of the ways to use EF …whether you build your model with a designer or with code and whether you use the ObjectContext or DbContext.
I’ve just finished up a book with Rowan Miller that is something of an extension to my book, Programming Entity Framework Second Edition (which is focused on Entity Framework 4). The new book is about 150 pages and is called “Programming Entity Framework Code First: Creating and Configuring Data Models from your Classes”. Very specifically about the modeling/mapping and DB initialization. We are now embarking on another short book that will be Programming Entity Framework DbContext. This second one will be focused on the DbContext APIs, validation and how to use them in various application patterns.
August 22, 2011
Vermont IT Jobs: Senior Embedded Software Engineer at NRG in Hinesburg
(note there is also a Software Engineer job available)
Senior Embedded Software Engineer
Job Description
August 2011
Primary ResponsibilitiesThis experienced Embedded Software Engineer will develop electronics instrumentation for the collection and transmission of meteorological data. This role will include writing embedded firmware for a variety of electronic system design projects involving the evolution and development of microprocessor-based electronics systems. The scope of responsibility will include concept development, requirements definition and validation, analysis and detailed design, implementation, verification, and optimization in a lean environment.
This is a full-time position in the engineering department and reports to the Engineering Manager, Instruments. This position will work in partnership with the engineering team to achieve goals of the department that are in line with the company strategic plan, and will embrace the high standards of NRG ethics and core values.
Qualifications· Write and test embedded firmware for microcontrollers in C language
· Work with Electrical Engineers to debug printed circuit board assemblies
· Work with Software Engineers to develop interfaces and protocols
· Work with stakeholders to develop product requirements and system designs
· Review the code of other engineers
· Help develop and continuously improve software development processes and tools
· Plan and manage feature requests and bug fixes after initial product release
· Product idea innovation
· System architecture design and system specification generation
· Design of experiments, qualification testing, data collection and analysis
· Hands-on prototyping and field testing
· Supplier and customer interface
· Measurement science
Technical Skills Preferred· Bachelor's degree in engineering or computer science
· 5 - 10 years experience in product design
· 5 years minimum experience in embedded programming
Technical Skills Required· Proficient developing in C for embedded microcontrollers
· Strong knowledge of mature software development best practices for the full software lifecycle including design, coding, testing, and supporting after release
· Experience working on complex software systems in a team environment
· Excellent written and oral communication skills
· Proficient reading electrical schematics, and basic understanding of analog and digital circuits
· Embedded system test plan development and execution
· Able to quickly and accurately estimate time to complete tasks for a project
Personal Skills Required· Experience in circuit design, analysis and test
· Experience with a variety of communications hardware and protocols
· Experience with electromechanical systems and systems integration
· Experience in systems specification and analysis
· Ability to work effectively in teams
· Strong attention to detail
· Ability to multi-task and meet deadlines
· Independence and self-direction
· Excited to learn
How do I apply?
Download an application (or stop by to pick one up) and mail it along with a cover letter and resume to:
ATTN: Human Resources
NRG Systems
110 Riggs Rd.
Hinesburg, Vermont 05461
You may also email your resume and materials to recruit@nrgsystems.com.
August 17, 2011
Vermont IT Jobs: Sr. Software Engineer, C# & more, Stowe
EverBank is currently recruiting for a Sr. Software Engineer for our Stowe office. This position is responsible for designing, programming, evaluating, recommending, planning, coordinating and maintaining software applications and solutions related to Web and Marketing technologies to improve and automate business processes thereby creating strategic advantage for EverBank. Seeking candidates with experience in C# 2-4, ASP.NET, XML, WCF, Web Services, JSON, (X)HTML, HTML5 - CSS3, JavaScript, JQuery, and AJAX. Please apply online at: https://www.abouteverbank.com/careers/opportunities-Apply.aspx?jobid=2589103.
August 16, 2011
Sessions for Vermont Code Camp III
The 24 Talks of Vermont Code Camp
Saturday Sept. 10th, Burlington Vermont
Once again, we have a fabulous array of talks with many technologies covered. We'll be building the actual schedule in the next week.
In alphabetical order……….
Chris Bowen HTML5 - A Practical First Look
Rene Churchill A Holistic view of Website Performance
Christian Cote SSIS Whats new in SQL Server Denali?
Rob Friesel CSS Wrangling with SASS
John Garland What's New in Windows Phone 7.1 Silverlight Development
Vincent Grondin Mocking and mocking frameworks
David Howell Tackling Big Data with Hadoop
Everett McKay Effective Prototyping: A developer's guide to better design through prototyping
Dane Morgridge Testable Entity Framework
Dane Morgridge jQuery & CoffeeScript: Let The Awesomeness Begin
Jim O'Neil Sampling from the Cloud Computing Smorgasbord
Dennis Perlot Silverlight Performance
Jonathan Phillips Functional Programming on the JVM
Al Ramirez What's New In ASP.NET MVC3
Maxime Rouiller ASP.NET MVC 3 for Web Developers
Josh Sled Dependency Injection
Josh Sled Emacs: Everday, Everyway
Eric Smith What is functional programming?
Kevin Thorley FOSS in the Enterprise
Etienne Tremblay Let's talk Virtualization
Matt Van Horn Getting High on MEF
Bill Wilder Applying Architecture Patterns for Scalability and Reliability to the Windows Azure Cloud Platform
Joan Wortman & Maura Wilder Introduction to the Ext JS JavaScript framework "for Rich Apps in Every Browser"
John Zablocki .NET and NoSQL: Relaxing with CouchDB
Bonus Parlor Chat Session:
Matt Van Horn : Software Consulting
More info vtcodecamp.org
Register vtcodecamp.eventbrite.org
August 15, 2011
Teaching a 5-day Workshop (Entity Framework Boot Camp) Oct 3-7 in Boston
I’m excited about embarking on my first full-week workshop. Until now, I have done a number of one-day workshops but I have always felt that I needed more time. There’s so much to share! Maybe five days will be enough?
The workshop will be in Boston (Waltham, to be exact) the first week of October. It is being coordinated by www.dataeducation.com.
Below is the course outline.
There is currently a $400 early bird discount until the end of August.
Details and registration at http://dataeducation.com/entity-framework-bootcamp/
Day 1: Introducing Code First
Why Code First?
How does Code First work at runtime?
Configuring Code First with Data Annotations and with the Fluent API
Configuring for validation, data attributes, relationships, database mappings and hierarchies
Understand impact on database
Understand impact on your application at runtime
Code First database initialization
Understand default and optional behavior and workarounds
Day 2: Introducing EF 4.1 DbContext /DbSet
How do DbContext and DbSet compare to ObjectContext/Object Set
Explore features of DbContext/DbSet that streamline EF coding
Integrate DbContext with your apps
Validation API
Fun with MVC 3 and EF 4.1
Days 3-5:
Hard Core EF 4 (and 4.1)
Architecting maintainable and testable enterprise apps with EF4/4.1
Repositories, unit of work, testing
EF in distributed architectures: ASP.NET, WCF Services, WCF Data Services
EF in the Cloud: Windows Azure and SQL Azure
EF performance tips and tricks
Working with large models and multiple contexts
Explore EF core API additions and improvements introduced in the June 2011 CTP
Enum support, spatial, TPT improvements, designer improvements and more
August 9, 2011
You Win! An EF 4.1 Update to Programming Entity Framework is In the Works!
After I finished writing the first edition of Programming Entity Framework, 832 pages long, I announced to anyone within earshot that if I every talked about writing another book to just shoot me.
After I finished writing the second edition of Programming Entity Framework, which came in at nearly 900 pages, I said “I really mean it this time"!
And then Entity Framework 4.1 was released with Code First modeling and the sweetness of the DbContext and other additions to this API.
Many asked me if I would update the book. I said “no” a thousand times and explained in this blog post, EF4 books and EF 4.1, why revising the entire book for what amounts to two small additions that don’t impact the core behavior of Entity Framework made no sense.
But you still asked.
I wrote articles and created videos.
But you still asked for a new book.
And then in a moment of insanity (I believe it was during 5 long hours of driving alone in the car to my parents’ house), I decided that maybe I could just write a short book that would essentially “tack-on” to Programming Entity Framework Second Edition.
And so it goes…this is what I am now working on. But I got smart this time! This spring, I worked on a series of content for MSDN with Rowan Miller from Microsoft. Rowan is a Program Manager on the ADO.NET Entity Framework team and has been instrumental in EF 4.1. He knows it better than most anybody. Certainly better than I do! And he’s a good writer. He’s a bit less verbose than I am (you can wrap that in exaggeration) but I’ve been working on him. I liked working on that project with Rowan and it did not take a lot of convincing to get Rowan to agree to do a book with me. I’m very lucky to have him as a partner-in-crime for so many reasons!
Rowan and I are collaborating on all aspects of this project. We are both writing, but we are working very closely together so that it is not disjointed. We’ll have a common writing style and there will be a storyline and buildup of code from beginning to end. We are helping each other with decisions about samples and how information should flow.
The Game Plan
We are writing two “mini-books” for O’Reilly Media. We are writing them as though they are a continuation of Programming Entity Framework. I expect that we’ll have the same Seychelles Blue Pigeon on the cover (or some twist on that). We’ll work with the same business domain , Breakaway Geek Adventures, and there will be references to the previous book (2nd edition). There’s just no reason to repeat explanations of API stuff that is the same.
The pattern for these books follows other recent offerings from O’Reilly. They will be short-ish (targetting 100 pages each) and presented as e-books (with print on demand availability). The first book will focus on Code First – more specifically, on building a model, database initialization etc. The second book will start where the first book ends focusing on the other half of EF 4.1, DbContext, DbSet etc. In this book we’ll be able to write real code with the combination of DbContext (etc) and Code First. This is where we’ll create some sample apps, repository, do some testing etc. We are already about 1/2 way through writing the Code First book and hope these will be out in mid-fall.
If you take a look at the CouchDB books that Bradley Holt ( a friend and neighbor and one of the Vermont Code Camp organizers – just coincidentally ) has written -- Writing and Querying MapReduce Views in CouchDB, First Edition and Scaling CouchDB, First Edition (with more to come)), this is what Rowan and I are doing. Note that Bradley’s books are also on Amazon (etc) and available for Kindle too. I don’t know how the pricing will work out.
The e-books will be in color (yay!). So as we copy our code from Visual Studio, we are leaving the code coloring in tact. The print books will be black & white.
We want to get all of the core writing done by mid-September, otherwise Rowan won’t be able to go attend his wedding and honeymoon. That wouldn’t be a great way to start a marriage, so we’re working hard toward this goal.
Julia Lerman's Blog
- Julia Lerman's profile
- 18 followers
