I want to create an Entity Framework Model based on database using VS 2015.
There is some problem:
1) When I want to create model I get this warning:

2) When I create mode some file being generate like T4.

3) Generated class hasn't Data Annotations like :
[EdmEntityTypeAttribute(NamespaceName="SomeModel", Name="tblCode1")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
4) In our group there are some people that have VS 2013 or 2010 that they can't use this type of models.
How I can create model using VS 2015 like VS 2010 or 2013 without T4 (Just 2 files like below)

Short answer:
You need to change the Code Generation Strategy property of the edmx from "T4" to "Legacy ObjectContext" and delete the .tt nodes from the Solution Exporer.
Long answer:
Here are the steps needed:
(1) Assuming you start by selecting "Add -> New Item -> ADO.NET Entity Data Model -> EF Designer from database".
(2) Follow the "Entity Data Model Wizard". The next is very important. When you get to the screen which asks you for the EF version you want to use, make sure you select EF 5.0, otherwise T4 template will be the only option you have:
(3) Finish the wizard. Say OK to security warnings like your first screenshot. The project structure will look like your second screenshot.
(4) Open the edmx file in a designer. Look at the Properties Window, there is a property called Code Generation Strategy which by default is "T4"

Change the property to "Legacy ObjectContext"
(5) Delete YourModel.Context.tt and YourMdel.tt nodes from the Solution Explorer and you are done.
A bit boring, but does what you want. The drawback is that you are limited to an outdated EF version, and the upcoming EF7 will retire edmx at all, so it might be a good time to start thinking of switching to the Code First approach. But until then, hope the above will help to keep your current process.
For generate "Code first" model (obtain a code first model starting from database) you can also use Code Smith Generator. You can start from POCO classes templates (or from NHibernate templates if you need serialization, IDataErroInfo, INotifyPropertyChanged, and so on implemented) and customize them is really simple (the syntax is based on ASP). Probably there is also a free version.
Looking around I found also an article and an open source tool that extract POCO classes from SQL Server database.
http://www.codeproject.com/Articles/892233/POCO-Generator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With