I am starting a new ASP.NET 5 Preview template to play with client side development.
I have a database ( MS SQL ) that I want to access using the Web API and Entity Framework.
In my Models folder I do like I am used to do, add a new item and I want to add the ADO.NET Entity Data Model but it isn't there.
What am I missing here?
UPDATE
This is the only thing I see when I try to add a new item to the project.
Client side and server side.
After a lot of research, I found out that there are some compatibility issues where come from the recent Microsoft migration to open source world (since Asp.net5) that I obtained from Data Points - The EF6, EF7 and ASP.NET 5 Soup MSDN Article. Read the full article please.
So if you wanna have both EF6 and Asp.net5, consider the article tips. And if you don't persist in using Asp.net5, simply use Asp.net4.5 (following image) which have Ado.net Data Model in Add New Item dialog (I tested its availability with my Visual Studio Enterprise).
May sound stupid, but since I got caught with this, it might be someone else's issue too...
In VS 2015, there are 2 project templates called Class Library... one being in Windows and one in the Web and having (package) suffix. Apparently, besides misleading name they have nothing to do with each other and the second one clearly is not made to support EF models... Make sure you have created a proper project type or open a working solution made with different VS version.
__
Also this might help. I have it already installed, so not sure if it affects my configuration or not (shouldnt as EF tools are supposed to be shipped already with VS 2015):
http://thedatafarm.com/data-access/installing-ef-power-tools-into-vs2015/
Right click on project
Choose Add and then New Item (or Simply press Ctrl+Shift+A)
You will see a Data section which you can find what you are looking for
Or You can find another solution Here:
Missing ADO.NET entity data model template from visual studio 2012 professional
Create New MVC Project using VS2015
Right-Click on Model folder.
Choose Add and then Select Class from the list.
Now select ADO.Net Entity Data Model... and go for your selection.
ADO.NET Entity Data Model missing Visual Studio 2017 Community
How to enable:
Open Visual Studio Installer -> Individual Components -> SDK's, libraries, and frameworks -> Enable EntityFramework 6 tools-> Modify
Now, Add item in your project -> Data -> ADO.NET Entity Data Model.
Visual Studio Installer
Note: While Creating project don't select class Library(.NET Standard) Choose Class Library (.NET Framework)
I solved the same problem by following these:
While Creating project don't select class Library(.NET Standard)
Choose Class Library (.NET Framework)
Choose ASP.NET Web Application (.NET Framework)
Go to Tools -> Get Tools and features. Select Individual components tab and check Entity Framework 6 tools under SDK's, libraries, and framework section
Remember you can't make an ADO.net Entity Data Model with an interface with .NET Core, its only possible with .NET Framework.
Related
I want to be able to debug into the Asp. Net Identity open source code https://github.com/aspnet/AspNetIdentity to better understand it.
How do I do it?
I did the following
I created a new ASP.Net MVC project (.Net Framework) using VS 2017 community edition
Downloaded the source code from https://github.com/aspnet/AspNetIdentity
Deleted reference to the Identity and Entityframework Identity DLLs from the MVC project and added the downloaded corresponding projects into the solution and referred to them
Interestingly neither the extracted open source Identity solution compiles nor mine does.
Can anyone pls put the steps? I guess I want to do the same for Asp.Net Core Identity and also customize the ApplicationUser class to add a salt field for example.
IDE :: VS.NET 2015
Version Upgrade :: 4.5 To 4.6.1
My asp.net solution contains more than 30 projects inside. I have upgraded the targeted framework to 4.6.1 and now i am getting these tons of error in EF classes. The existing EF version is 6.0.
Please suggest how to fix these errors cropped up from the EF classes. Should i upgrade the EF version also from the Nuget console also.
If you have any models created with the EF Designer, you will need to update the code generation templates to generate EF6 compatible code.
Delete existing code-generation templates. These files will typically be named .tt and .Context.tt and be nested under your edmx file in Solution Explorer. You can select the templates in Solution Explorer and press the Del key to delete them.
Note: In Web Site projects the templates will not be nested under your edmx file, but listed alongside it in Solution Explorer.
Note: In VB.NET projects you will need to enable 'Show All Files' to be able to see the nested template files.
Add the appropriate EF 6.x code generation template. Open your model in the EF Designer, right-click on the design surface and select Add Code Generation Item...
If you are using the DbContext API (recommended) then EF 6.x DbContext Generator will be available under the Data tab.
Note: If you are using Visual Studio 2012, you will need to install the EF 6 Tools to have this template. See Get Entity Framework for details.
If you are using the ObjectContext API then you will need to select the Online tab and search for EF 6.x EntityObject Generator.
If you applied any customizations to the code generation templates you will need to re-apply them to the updated templates.
In Existing project implementation done from edmx model first approach EF I have to use Code First approach . In existing project developed creating repository BO ,base Bo ,Enum classes . Have to reflect the same with just change in approach.
You can use the EntityFramework Reverse POCO Generator Visual Studio extension. As its documentation says:
Reverse engineers an existing database and generates EntityFramework Code First POCO classes, Configuration mappings and DbContext.
Also, you can use the Entity Framework Power Tools Visual Studio extension, which includes more functionalities, like generating diagrams of your data models.
To use EF PowerTools with Visual Studio 2015 do as explained in this post.
In addition to generate your POCO entities and database context you will have to enable the use of migrations with the Package Manager Console and to generate at least an initial migration for your database. You will get a migration Configuration class, and will need to configure a Database Initializer. This page explains the basics of these steps.
I noticed that this type of project does not support files edmx.
What is the right way to develop a project in Asp.net 5 MVC 6 using Entity Framwork 7?
Currently(as of EF 7, RC1) Database First support is still in development. More info on roadmap page here and on EF Design meeting notes here.
Since this is in development there are ways to try this and more info and tutorial on commands can be found at official documentation page here.
The problem is that EF7 kill EDMX. You now have Code First-style POCOs tied to an existing database, without an EDMX file in sight. The EF Power Tools Visual Studio extension can be installed to generate all of this directly from existing database.EF Power Tools Visual Studio extension actually doesn't support vs 2015
I want to install Entity Framework in my ASP.NET 5 MVC project using project.json.
In the dependencies section I start typing EntityFramework and I only see
"EntityFramework.SqlServerCompact": "6.1.3" instead of "EntityFramework.SqlServer": "6.1.3".
What is the reason for this and what effects will this have?
Are there limitations in the compact version?
If I create a new ASP.NET 4 project with MVC and install EntityFramework then I see the EntityFramework.SqlServer reference installed and not the compact.
EntityFramework.SqlServerCompact is for interacting with SQL CE. It's a single file based database. If you're dealing with MS SQL Server, that's definitely not what you want. You want EntityFramwork 6.1.3, there is no EntityFramework.SqlServer.