Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database First Import
Message
From
25/01/2013 14:04:46
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
General information
Forum:
ASP.NET
Category:
MVC
Environment versions
Environment:
C# 5.0
Database:
MS SQL Server
Miscellaneous
Thread ID:
01562068
Message ID:
01564118
Views:
47
Thanks Rick. I'll check out your suggestions.

>>>As the name suggests: Code First is meant as a coding tool and not a Wizard interface. The other Entitity Framework modes - Database First and Model First are better aimed to deal with complete database imports than Code First which is meant as a coded approach to generating a database from the model.
>>>
>>
>>Regardless of where you start, you end up with all three (database, model, code) right? Or is that only because I'm using the scaffolding?
>
>No that's only because of the scaffolding. Imports should only generate the model - whether it's a CodeFirst classes model or a EDMX model (for classic EF with ObjectContext). The EDMX approach allows for a visual designer and some two way data updates. Code First requires coded models that update the database (either automatically, manually or via migrations). The Scaffolding is something separate from EF.
>
>>By the way, do you like to use EF for MVC projects, or do you prefer something else? Also, where do you put your business logic? I'm talking code beyond simple validations. MVC Scaffolding implements a "repository" layer, but I haven't looked into what that really means.
>
>Yes I've started using EF CodeFirst in recent projects and it works fairly well. All of the projects have been small to medium sized and I haven't really hit any limitations. Hardest part is making sure you produce valid models that can be mapped properly to the database (ie. no FK validation errors and circular references etc.).
>
>As to business logic: I use a business object layer that sits ontop of EF - it knows about EF and provides basic CRUD operations and hooks to override common behavior. This is where all my business logic goes. The app then consumes the business object. This is similar to a repository object but with a little more internal logic and knowledge of EF baked in. It's part of the West Wind Web Toolkit if you want to check it out, but there are not a ton of examples at the moment.
>
>You can find the code here:
>http://www.west-wind.com:8080/svn/WestwindWebToolkit/trunk/Westwind.BusinessFramework/EfCodeFirst/
>
>+++ Rick ---
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Previous
Reply
Map
View

Click here to load this message in the networking platform