Any Data Annotations tutorials that use EF Database-First approach to explain the subject? - entity-framework

All tutorials on Data Annotation attributes I've found explain the subject using either Asp.Net or EF Code-First examples. I don't know either of the two, so do you know of any tutorials that would explain the subject using EF Database-First approach?
Thank you

Here's one that's for ASP.NET Web Forms with EF Database First:
http://www.asp.net/web-forms/tutorials/getting-started-with-ef/the-entity-framework-and-aspnet-getting-started-part-8
This is the last installment in an 8-part tutorial series.

Related

Entity Framework - Is MS Going To Be Dropping Support For Database-First Approach

When I read posts about db-first vs. code first approaches, I get the impression that code-first is the rising star and superior to db-first so that db-fist is about to be deprecated in the future releases of Entity Framework.
I could not find an official statement from Microsoft but they seem to be endorsing code-first by things like Identity Framework etc. Would it be a mistake to start a new project using EF DB-first?
You have EF 6 for the more traditional EF and EF 7 which became EF Core.
In my opinion you are better off focusing your effort on using EF independent from either approach.
Here's a link to an article written by EF Expert Julie Lerman.
https://msdn.microsoft.com/en-us/magazine/dn890367.aspx

how do you access metadata from a T4 template with code-first entity framework?

I'm using Entity Framework with database-first because that was an easier learning curve. I've read that EF 7 will no longer use the EDMX file and that code-first will be the way to go.
I'm thinking of going ahead and converting to code-first now because my project is still relatively young, but am not sure how to get access to the metadata that EDMX provides. I use T4 templates extensively and need to get access to the metadata.
Is anyone using T4 templates with code-first, and if so how are you getting the metadata?
thanks,
john
Use the EF Reverse POCO template available in the VS Gallery
The answer to the question is that metadata is available from the context object, as discussed in this post
How I can read EF DbContext metadata programmatically?

Does Entity Framework DB First (EDMX) prevent proper Separation of Concerns?

I am new to entity framework and MVC, and trying to understand what constitutes a good design approach for a new application.
There are several ways of using Entity Framework. However, for my project, the best looking option is DB First. I've played around with an EDMX file, and I have got as far as using the DbContext code generator to create my wrapper classes.
I plan on using the repository and unit-of-work patterns, and using ninject for DI.
However, it does not seem "proper", from a SoC point of view, that whilst my respository will hide the implementation of the data store (EF) from my code, the model classes themselves are very much EF flavoured.
It seems that using EDMX-based approaches to EF blur the separation of concerns. Only POCO support seems to allow a true separation, but POCO has some other limitations that I don't like.
Am I missing something, or does using EDMX have this drawback?
Are people using an auto mapper to convert between the entity model and another, clean, SoCced model?
thanks
Tian
I don't have a strong opinion on the Separation Of Concerns question, but I have used both the standard ADO.Net version of EF and POCO and it is not difficult at all to customise the output of the the T4 code generation script for POCO to address any concerns you have about the structure of the objects created. That sounds like it would probably be a good starting point for what you are looking to do.
Once you know you are looking for T4 templates there are quite a few tutorials and a lot of helpful SO questions that can give you an idea of what you need to do.

Purpose of Entity Framework DBContext Generator

This is probably an obvious question to many but I'm scratching my head over this one.
Can someone explain to me what purpose/advantage generating POCO classes via t4 templates such as the ADO.Net DBContext Generator has over standard EDMX data access?
I understand that they offer extensibility over the entity class definitions, but if a development team is not interested in that what other obvious purpose or advantages do they have?
Thanks
As mentioned by ThomasH in the comments the provided link gave me the info I needed.

Fluent API, Annotations and EF 4.1

Would somebody please guide me towards links that explain Fluent API and Annotations when using EF 4.1 code first please? The more in depth, the better.
Thank you so much for your help in advance!
May issue of MSDN magazine contains article about EF 4.1. For further information check these blogs:
ADO.NET team blog
Morteza Manavi's Blog
Julie Lerman's Blog
You can also check this video but for that you need a subscription ($29 per month).
Almost everything can be found on Stack Overflow ;)
code-first ef-code-first entity-framework-4.1 dataannotations
http://msdn.microsoft.com/en-us/data/aa937723 has many tutorials on Entity Framework 4.1
Fluent API : http://msdn.microsoft.com/en-us/data/hh272551
Data Annotations : http://msdn.microsoft.com/en-us/data/gg193958