Where is EntityConfiguration and ContextBuilder in Visual Studio 2010? - entity-framework

I see examples about code-only POCO for en entity framework 4, but I cannot find the classes EntityConfiguration and ContextBuilder and I cannot see which reference I need to add to have them.
Is it part of the .Net Framework 4 or do we have to download something else?

The POCO stuff you're looking for is in a separate download. Current version is at http://www.microsoft.com/downloads/details.aspx?FamilyID=af18e652-9ea7-478b-8b41-8424b94e3f58&displayLang=en
Once you run the installer, you'll need to grab the Microsoft.Data.Entity.CTP.dll file (mine was in the C:\Program Files\Microsoft ADO.NET Entity Framework Feature CTP3\Binaries directory). Make a project reference to the new dll and you should be set!

Related

Entity Framework 6.4.4 (.NET 4.7.2) - No connection string named

Good day,
I've created a C# .NET 4.7.2 class library project which integrates EF6. When the parent project makes any call to the DLL for db access, the above exception is thrown.
A common solution is to include a reference to EF in the parent project and to copy the connection string element from the class library's app config file. This indeed works, but is not ideal. I really envision all of these settings encapsulated within the DLL.
Anyone have a work-around?
Thanks.

Reference .net core 2.0 into a .net 45/46 project

How can I add a reference of a .Net Core 2.0 project into my .Net 46 project?
My project is structured as follow:
Solution
- Data Project (.Net Core 2.0)
- Test Project (.Net 46)
I'm trying to reference the Data Project into my Test Project as I need to insert some data using it. The only reason I created a .Net Core 2.0 is that I'm trying to use Entity Framework on Visual Studio for Mac and it didn't work using the "normal" Entity Framework nuget package, so I opted for the EntityFrameworkCore.
I was able to manually reference the Data Project dll, but then when I run a test I get the message
"Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.0.0. Culture=neutral' or one of its dependencies"
Is there any solution for this? If not, what's the best way to work with Visual Studio on Mac and Sql Server when you need to retrieve and insert data? Would Dapper work?
Thanks
What you asked is impossible.
.NET Framework projects can only consume .NET Standard Class Library projects, but not .NET Core projects.
See the reference for more information,
https://blog.lextudio.com/which-class-library-project-to-go-in-visual-studio-2015-2017-a48710cf3dff

Installing EF to .NET core library project

I am new to .NET core. Trying to get used to it. But its kind of complicated.
I have my poco classes in 'solution.Entity' library project and I want to use them to create a database with EF code first in my 'solution.Data' library project.
But when I try to install Entity Framework via Nuget to my 'solution.Data' project it says 'Package Restore Failed. Rolling back...'
Both projects are .NET Core Library projects.
What do I need to do to be able to use EF in .NET core library projects? It's look like I need some kind of configuration.
Thanks for helps.
Make sure you're installing EF Core. .NET Core has it's own implementation of Entity Framework.
This should be the NuGet package you're installing.
There are lots of pieces to getting Entity Framework Core working right. I highly recommend taking a look at the docs. There are dozens of samples that show how to setup a project.
https://github.com/aspnet/EntityFramework.Docs
http://learn.microsoft.com/ef/
In particular, I suggest this guide. It will talk you how to take your POCO classes and make a database in a .NET Core project. You will likely find it easiest to keep.everything in one project for now and move code into separate libraries once you get more familiar with EF.

Cannot add Nuget packages to ASP.NET vNext project

So I decided to take a look at this new Visual Studio 14 CTP. When I tried to add a package from Nuget library (Raven Database Server precisely) to my ASP.NET vNext Web Application, it felt like nothing really happened. Not a single piece of solution has changed, and the References remained the same.
I tried adding it manually using my "Project.json" file (as seen in this article), but IntelliSense didn't provide me with any fill. I actually tried it in a lot of different ways, with a whole lot of Nuget packages, with the same result.
Can anybody explain this situation?
ASP.NET vNext supports two targets: .NET 4.5 and CoreCLR. When targeting .NET 4.5 (net45) you can add any existing NuGet reference. When targeting CoreCLR (k10) you can only add NuGet references that support it; today, only some packages support that.
The package that you mention is only available for net45. To add a reference to it, add the package as a dependecy in the net45 section of project.json - just like autofac is added in this file
The entry should be: "RavenDB.Server":"2.5.2879"
PS: the manage NuGet references dialog is not functional for ASP.NET vNext projects in this version of VS

How to Upgrade from Entity Framework 4.0 to 4.3

I have a project that uses Entity Framework 4.0. From within that project, I installed 4.3. Some changes appeared in my app.config indicating that I was now using 4.3. However, my generated code still inherits from ObjectContext and creates ObjectSets even if I delete and re-add the edmx. How do I get the generator to use DbContext and DbSets?
You must download DbContext T4 template from Visual studio gallery - you can get it from extension manager in Visual studio.