Entity Framework: Building Applications with Entity Framework 6

Download this episode

Download Video

Description

In this session we explore the features available in Entity Framework, including the latest EF 6.1 release. See how these features can be used to build and test applications, including integration with other technologies and third-party frameworks for dependency injection, testing, logging, etc. We also take a look at demos of some new features that the EF team is currently working on.

Day:

3

Session Type:

Breakout

Code:

DEV-B417

Room:

Grand Ballrm B

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      meisam

      where is video or download link??

    • User profile image
      ErikEJ

      You can read my blog post on the subject here while waiting for the live stream http://erikej.blogspot.dk/2014/05/entity-framework-reboot-ef7-get-sneak.html

    • User profile image
      mfornaris

      @ErikEJ: still no link to the live stream

    • User profile image
      carlospined​ag

      A lot of things "hard coded" in an application that uses EF.
      You can imagine a big enterprise application (500-1000 tables): hard to maintain.

      If model changes:

      Will be necessary to "dive" into the code in order to find the impacts of changes?

      For instance, what about changes in navigation properties of EF? (changes in associations between tables) We need to "dive" into code in order to change the qualification of fields.

      In my opinion, a "code based" approach is not the best way to manage the different challenges of Object-Oriented analysis and design (Change propagation, Impact analysis, Inconsistency management, Model refactoring, Round-trip engineering, Version control, Traceability management).

      You can see a paper about Evolving Models: 

      http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.130.9786&rep=rep1&type=pdf

    • User profile image
      jsiahaan

      @carlospinedag:You can use separate "partial class" to customize your model. Classes on EF use "partial class" to accomodate customizations.

      Have fun

    • User profile image
      Criss

      no link ?!

    • User profile image
      romiller

      @meisam & @mfornaris - The live stream from TechEd is here - http://channel9.msdn.com/?WT.mc_id=tena_hp. Videos will only show up on these pages after they have been processed. Sorry not to get this info to you in time to watch the session live.

    • User profile image
      romiller

      The Bitly bundle I mentioned during the talk is here - http://bitly.com/EFTechEd2014

    • User profile image
      tomato45un

      Cool EF 7. Good job romiller.

      I been waiting to use EF into noSql (AzureTableStorage).

    • User profile image
      Rikard

      But updating web.config kills the process

    • User profile image
      iwhp

      Could we have access to the source code of samples you provided?

      Thankx, Harry

    • User profile image
      romiller

      Source code is now available here - https://github.com/rowanmiller/Demo-TechEd2014

    • User profile image
      Alex Gil

      Lovely implementation of Soft Delete. I worked in a few projects where I had to create each query with the condition IsActive = 1. I'll definitely use this approach in the future. Thanks Rowan!

    • User profile image
      Ian Marteens

      Will ModelFirst/DatabaseFirst be dropped in EF7, or is that just a temporal limitation?

    • User profile image
      Thorium

      Good lecture, but couldn't be possible without a lot of code snippets... Type casting and null-checks. I don't like the state we are now with C#.

    • User profile image
      Raghav

      Good lecture!!! However can we intercept the pipeline to do Full text search rather than writing SELECT query ourselves. Is it something you guys thought about. Also in your demo with Soft Delete, How do you handle the softdelete in a graph say in a 1-* relationship, Should nt we apply softdelete on dependents as well when the parent is applied with softdelete. ???

    • User profile image
      BlackTiger

      The Question for me is - why do I need so many movements and so much code to simply do "update" instead of "delete"?

      People think too much about "process" instead of actual result nowadays.

       

    • User profile image
      IlijaInjac

      I agree with @BlackTiger . The soft-delete implementation looks like a huge overhead for a concept that exists for ages. We did that already in dbase. I think the goal should be to simplify EF instead of making it even more complicated. Soft-Deletes and other well-know techniques should be built into the framework and ready to use.

    • User profile image
      romiller

      @Ian Marteens - I think I covered the answers to your questions in the discussion we had in the comments of the corresponding blog post. Feel free to follow up with any other questions if I didn't answer everything.

      @Raghav - There isn't really a good way to do this, you could intercept at the SQL layer (using DbCommandInterceptor) but you would be limited to string manipulation of the SQL command text at that point. You can't do it at the query tree level because there is no concept of full text search in the query object model.

      @BlackTiger & @exgrip - Agreed, the point of the demo wasn't to say this is the ideal way to handle soft deletes (we should ideally have first class support in EF itself). The point was to show the types of things you can do with the interception points included in EF.

       

    • User profile image
      carlospined​ag

      @jsiahaan: in my experience, the process of developing large projects implies a continuous evolving of a lot of large models. Change management (in analysis, design and development) is critical to reach success.

      In my opinion, the problem with the "code-based" approach of EF is the hard dependence between model and code: you need to "dive" into the code in order to find the impact of each change in the model.

      Try to use EF for large projects...

    • User profile image
      mannysiddiq​ui

      @carlospinedag I agree; I am also not a huge fan of Code First. Model first is more natural for me; helps keep the database design ownership to select few! Code First makes it difficult to keep control over your db model. I also don't like the idea of C# code driving my database design; I would rather design my database model, generate the differentiating SQL, provide is to the developers so that they could code their stuff on top of it.

      @romiller, currently we are working on a multi-year Azure SQL Database / MVC / Web API / EF 6.1 project that uses model first approach. Can you please provide any guidance or tips and tricks for us to avoid making any mistakes that might cost us time/money while upgrading from EF 6.1 to EF7 in the future? Will there be no tooling in EF7 to generate classes/context from the model?

    • User profile image
      romiller

      @mannysiddiqu​I - There is already tooling to create a code-based model from an existing database schema in EF6 and this will continue to be available in EF7. Probably the most important thing to consider in terms of future proofing is to use the DbContext API in new applications.

    • User profile image
      carlospined​ag

      Cloud Computing brings new trends.

      In the future PaaS will be not only "managed DBMS" or "managed App Servers", in fact, the DBMS and App Server will be agnostics, for this reason, new developments must consider the independence from specific DMBS and frameworks. In the future, PaaS providers will offer software factories in the cloud.

      A "Model-Driven Engineering" (Platform-Indepedent Model Vs. Platform-Specific Model) approach will be more usefull and portable than a "code-based" approach. (For reference see: http://www.omg.org/mda/)

      The general rule for future is: don't "marry" with specific platforms, if you follow this rule you can go from one cloud to other, in a quick & clean fashion.

      30 years ago the success of microcomputers was the offer to be "IBM PC Compatible" (your apps can run on any microcomputer). In the future, the compatibility will be between clouds.

    • User profile image
      Oscar

      I'm trying to implement a similar solution to manage authorization.

      I have posted it in MSDN forums:

      http://social.msdn.microsoft.com/Forums/en-US/011562c9-b7ac-4064-994d-1e6ff9d70009/ef-611-interceptors-and-visitors?forum=adodotnetentityframework

      Anybody can help me?

      Thanks.

    • User profile image
      Hosein Alipourian

      Hi Miller,
      Definitely one the best lectures on the topic... However while I was wondering around the interceptor concept, I've encountered an strange behavior trying to set a property to a function's returned value by using DbExpressionBuilder.SetClause(). It is not rendering anything in generated SQL statement for the function. It looks like a bug to me, but I might be wrong missing something. Can you confirm this?

      To reproduce the problem you can try to set a property value with an DbFunctionExpression in your soft delete example (EF 6.1.1). Also arithmetic expressions does the same.

      Thanks.

    • User profile image
      mixXtUpp

      "Code First definitely has some rough edges for enterprise/large apps. One of those was the substandard tooling for reverse engineering a model from a database..."  That's been my experience--code first was much harder and more error prone than using EF Designer and this is one of the reasons I'm not a big fan.  Hopefully EF7's tooling will change my mind...

    • User profile image
      tmclane123

      I've asked this question on SE and MSDN, but I can't link to the pages here as my comment gets rejected as spam. Title of both questions is "Add extra database command with CommandTree interceptor".

      I am trying to implement an auditable datastore in Entity Framework using interceptors as detailed in this video. My intention is to keep a history of every record's state at any given point in time. This requires that I convert all delete statements to updates and all update statements to update + insert.

      The issue I'm running into is that I cannot figure out a way to add an extra insert into the command tree. Is this possible with EF Interceptors?

    • User profile image
      danielkatz

      I suggest to tag it also as Entity Framework, since it is the main focus of the talk. And it was quit difficult to find it...

    • User profile image
      Ashwin

      The bitly bundle http://bit.ly/EFTechEd2014 is not working

      Any other alternative link?

    • User profile image
      Manoj Chamikara

      The bitly bundle Not found
      http://bit.ly/EFTechEd2014
      Any Update Link?

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.