Enity Data source wizard only compatiible with framework 5 - asp.net

I'm going to try and connect to my EF Data Model for the first time and when I do I pull this error message:
This version of the Entity Data Source wizard is only compatible with Entity Framework 5. If you’re not using Entity Framework 5 you can configure the control by editing the markup on the page. The page editor has IntelliSense support for ASP.NET controls. If you’re using Entity Framework 6 you should also be using the EF6-compatible version of the Entity Data Source control, available as the Microsoft.AspNetEntityDataSource package in NuGet.
Now this threw me a bit because I thought that I had all my updates in place but I went back to NuGet and double checked and did a full refresh of anything I could to make sure that VS knew it was there an verified everything was in place and on 6 as intended. Then I noted in the update tab there was three items there that I could put up (Bootstrap 4.0.0-alpha2, Microsoft.AspNet.Idntity.EntityFramwork v3.0.0-rc1-final, and Microsoft.NetCompliers v1.2.0-rc). This I attempted but that bombs out with the error:
Failed to add reference to 'System.Runtime'. Please make sure that it is in the Global Assembly Cache.
I'm a bit stumped here... no path forward no path backward that I can see.

Related

How to properly update SQL database in Azure after EF Code First model of asp.net mvc model change?

It seems like I always have a variety of problems doing this, and usually I end up nuking the db out of frustration and rebuilding, but obviously there has to be some way to do this.
I have an existing asp.net mvc web app living with its sql db in azure. Works fine has some data that can be replaced but, again, the point is to learn how to update model without destroying the database.
In VS2017 I add one property public string ScreenShot { get; set; }
I make some small changes to my mvc and web api controllers to handle this extra property. I update my localdb via packmanager console and add-migration addprop and update-database. Works fine, run it locally, no probs.
Goto publish, goto settings, check update database. Click publish.
It hangs for like 5 or 6 min and I get:
Warning : A project which specifies SQL Server 2016 as the target platform may experience compatibility issues with Microsoft Azure SQL Database v12. when publishing
I try publishing several times and get the same thing. Google, look around, scratch my head, try again and it seems to publish. Site opens, and somehow I have lost my bootstrap theme. In fact in my Content folder I now have 4 files i believe are new: bootstrap-theme. (css,css.map, min.css, min.css.map) (same prefix , different suffix) as well as what I think are virgin versions of those without theme in the name, and seems to be the default mvc theme of black and white.
When I goto my app and I get an generic error and checking elmah I get:
System.InvalidOperationException: The model backing the 'TaskTrackerContext'
context has changed since the database was created. Consider using Code
First Migrations to update the database (http://go.microsoft.com/fwlink/?
LinkId=238269).
Well I really thought thats what I did. Almost forgot one thing! Maybe this is where my problem lies: I actually had to run two migrations-in addition to the model change I dropped a column that had never been used (scaffolding a controller for a DTO version of one of my models added it to my context which created a table).
I did create a new branch before making any of these change so I could just revert back but at some point I have to make this work and have to understand how to do it without destroying my db and remaking fresh.
A check in SQL object explorer shows it added the ScreenShot column to my table but didn't remove the unused table.
This works for me :
In visual Studio, go to publish settings and then select the option
Execute Code First Migration
Please see the screenshots below
Kind regards

ASP.Net prompting to change System references to Global.System references

I am a new developer and I am not sure how I have broken my application. My asp.net application has somehow lost reference to the System library. When I build it throws hundreds of errors and every error asks me to change any System reference to a Global.System reference. Such as:
Error 4 Type 'System.Data.Linq.DataContext' is not defined.
This is not specific to any child of System, it's every System reference on any piece of code in the whole application.
I'm using Visual Studio 2013 for Web with a Target Framework of 4.5. Here is an image of my "references" portion of the my solution.
The System.dll file is present in that location. Please advise.
EDIT I think Mark was on the right path, I simply created a new project and added the relevant existing items into the new project. This removed whatever conflict I inadvertently created.

Unable to load the specified metadata resource still comes

Yes, I know, this is the n'th question around this issue. I tried a lot of mentioned ~solutions, but none of them worked for me.
Windows 8.1, Visual Studio 2012, .NET 4.5.51641, Entity Framework 6.1.1
My struggle is to configure a well structured ASP.NET project, separate the different entities. I need more entities and in separate folders because of some overlaps among generated class names.
Therefore I've created a DAL folder and the first one, the Production. My model is quite simple, during the mode creation I've created the ProductionEntities entity connection string as it seems bellow:
Here is the ProductionModel.edmx and its properties:
I checked the assembly with reflector, all the resources are correct:
After that I've created a webpage and an EntityDataSource within it. If I select the ProductionEntities for Named Connection, I get above mentioned error message.
Have anybody some fresh idea for this? Thanks in advance!
I've got the solution!
After creating the entity model, it is MANDATORY to compile the project! After compilation the VS is going to recognize the entitydatasource wizard works fine...

Cannot use Linq to sql due to System.Data.Linq being unavailable

I am new to webforms. I am trying to setup a linq to sql connection. I did it the (what I think is) the standard way. I added a linq to sql class. Then I went to my database explorer and dragged a table in and saved. Whenever I try to load the project in the browser I am getting the following error:
The type or namespace name 'Linq' does not exist in the namespace 'System.Data'
I am kind of at a loss here. I googled around. I saw some of the standard solutions like add a reference to System.Data.Linq (which I already had but did again) and to make sure debug="true" in my compilation tag and target framework in my compilation tag was the same as the target framework for the project which I did (both are .NET 4.0). I am still getting the error and I have no clue on how to proceed from here.
The error is thrown on the following line of the Conditions.dbml file:
using System.Data.Linq;
Add a reference to the System.Data.Linq assembly. Right click the References folder in your project, go to Add Reference, then make sure you're on the Assemblies tab and add a checkmark next to System.Data.Linq. (These directions are for VS 2013).

Errors when including Entity Data Model across referenced projects

Decided to take a dive into recreating a website so that it's an ASP.NET MVC web application. We were originally using the Entity Framework for it, figured to still use it since it works nicely enough. When doing some reading, noticed the there is no such thing as the App_Code/ folder for MVC applications, and that most people were creating a class library for their needs like that. So what I ended up doing was creating my MVC application and a class library, both in the same solution, and the MVC application was referencing the class library. The class library has my EDMX Entity Data Model file in it since some of my classes reference it and I thought that it would be easiest to have it in the library to reference. So here is a picture to what my solution layout is. But when I build and run the website, I get an error on a page that would reference the Entity Data Model. Here is a picture of what the error is.
So I thought, what if I placed the EDMX into my models folder since the error looks like it's complaining about not finding the entities. Here's a picture of my solution now with the move. But now, I'm getting a different error (picture). I'm kind of at a loss as to where to go from here. Is the way I have everything laid out and designed the proper and most efficient way to do it? If not could someone give me some advice?
Thanks, it's really appreciated!
Yes, you should be able to have the edmx in a class library and reference if from your main project. The first error is likely due to an incorrect connection string (check this blog post) but you may also have changed the build action of the edmx file somehow, make sure it is "Entity Deploy".
The second error is probably because you copied the edmx from your class library into the Models folder and it is still referencing the old namespace. To fix that, open the edmx in designer view and click on the background. One of the properties in the property window is Namespace, make sure that's set to the new place you want to keep it.
Edit:
Some things to try:
Clean and rebuild the project
Delete the Temporary ASP.NET Files folder referenced in the error message
Double check your cshtml files for old references to URG_MVC.Models namespace. For example, the line in the error should be IEnumerable<URGLibrary.Proposal>
Right click the edmx file and select Run Custom Tool to regenerate the model files

Resources