Can anybody get ASP.NET Dynamic Data Entities Web project working under EF 6.0.2 and .NET 4.5 in Visual Studio 2013?
I find problems in ManyToMany_Edit.ascx.cs and Global.asax.cs all relating to the switch in namespace for ObjectContext. Changing the using statements in the generated files is not enough. In other words, following this guide is not enough.
System.Web.DynamicData.dll doesn't seem to be aware of System.Data.Entity.Core.Objects.ObjectContext.
Have you read this post? http://blogs.msdn.com/b/webdev/archive/2014/02/28/announcing-the-release-of-dynamic-data-provider-and-entitydatasource-control-for-entity-framework-6.aspx , this works for me
Related
I'm using Visual Studio 2017, v15.3.1 and am trying to follow a tutorial about creating some WebAPI endpoints with Entity Framework, as outlined here
In my case I'm using the good old Northwind SQL database instead of the author's blogging example, which I don't think should be an issue?
At any rate, when I get to the bit where I'm supposed to create a controller, I right-click the controllers folder in my solution, select 'API Controller with actions, using Entity Framework' and choose my EF model class (Orders, Employees, it doesn't seem to matter) and the Data Context which I generated successfully earlier in the tutorial.
When I select Add there's an attempt to scaffold, but I'm then told in a popup: There was an error running the selected code generator: 'No parameterless constructor defined for this object'.
I've looked at this error message online and others have had similar problems, but nothing they tried quite matches my scenario, and their solutions haven't fixed this issue.
My generated EF model classes do have parameterless constructors defined, so I'm not sure what the error is referring to?
everyone.
I'm trying to create new Scaffolded item for simple ASP.NET Wep API application which should be based on domain object class and DbContext derivative in separate assembly. The assembly is in the solution, target app has a reference to it (and manually created code which invokes the classes from my lib is build up without any errors) and, obviously, the classes I've mentioned have access modifier public.
The problem is wizard for creating new scaffolded item cannot see my model classes. (By the way, when the model classes were in another ASP.NET MVC5 app the wizard worked well.) I'm using Visual Studio 2013 Update5.
How to fix this? Any workaround would be helpful too!
Sorry for disturbing.
the origin of the problem seems to be that I've move my data model classes from ASP.NET MVC app into my class library in wrong way.
I've not just cut/paste them, but copy-paste, cut-paste (confirmed replacement).
this is the only thing which could cause the problem (although I still don't know the details).
Never the less I've started from the beginning again and cut/past the data model files initially - everything seems to work fine now.
I am trying to upgrade my MVC3/.NET4.5 application to use EF6.1, in the main part for its performance improvements.
One of my problem code lines is :
private AppEntities db = new AppEntities();
I have removed system.data.entity from references and web.config, but this line still seems to be looking for this dll. I did try and add:
using System.Data.Entity.Core.Objects.ObjectContext;
Did not seem to fix the issue with AppEntities line trying to find system.data.Entity v4.0.0.0
Many thanks
EDIT:
I managed to sort this by adding:
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Objects;
to AppEntities.cs file.
Also needed to add to some of the POCO files.
using System.Data.EntityClient;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
It all builds fine.
However my problem now is that it seems to take an age to show the page on first load, guess this is to do with native code creation. Also I have heard that much EF code that was native in .NET is now MSIL in Entity Framework.dll and thus need compiling to native code as well. Perhaps this is what is causing my pain, see: EF6 Warm up metrics
How to disable code-first feature in EF (Visual Studio 2012)
I am using Visual Studio 2012, MVC4 (Internet application template).
I want to use EF, but not with its code-first feature. I would want the application to error out, rather than create or modify my database based on my code. (i just can not live with this feeling of my database being changed behind the scenes ... i want the application to use the exact db i have created ... and if there is any thing that has to be changed, i'll do it my self)
is this possible with the new Ef (VS2012)?
i have seen many people asking this, but so far i am unable to find the answer.
You can use Code First and ensure that your database never gets updated or overwritten when you change your model by setting the database initializer to null:
Database.SetInitializer<MyDbContext>(null);
It's a static method of the Database class and should be called at the beginning of your application, for example in global.asax or in a static constructor of your context class. Doing this you have to change model class and database schema manually so that they match.
You can also use the Reverse Engineer feature to create a Code First model from an existing database. It is explained here: http://msdn.microsoft.com/en-us/data/jj200620
Or if you don't want to use Code First at all and work with a model designer you can use the Database First approach, explained here: http://msdn.microsoft.com/en-us/data/jj206878
An overview about all the possible options is here: http://msdn.microsoft.com/en-us/data/ee712907.aspx
I try to below link for window application with MEF
http://geekswithblogs.net/malisancube/archive/2009/05/26/managed-extensibility-framework-101---a.aspx
it's work good in Framework 3.5 but when i try to develop same code for framework 4.0
not able to find below function
return container.GetExportedObject<Form1>();
please give me some properly example for window application with MEF where my container all the Usercontrols on Form
MEF was being developed pre-.NET 4.0 but it became an official part of the framework from .NET 4.0 forwards. The API you are looking for is actually the ExportProvider.GetExportedValue<T> method which CompositionContainer inherits from:
return container.GetExportedValue<Form1>();
GetExportedObject was renamed GetExportedValue, and it occurred with MEF preview 6, which means that blog post was actually based on quite an early revision of MEF.