EF suddenly cannot be found - entity-framework

While working on my MVC 5 project, the main db reference seems to have been broken.
CS0246 The type or namespace 'IntranetEntities' could not be found
(are you missing a using directive or assembly reference?)
When I am in the Model.edmx, it will link to the SQL server and update.
What would cause my "IntranetEntities" db reference to be broken?
How can I re-establish it?

Related

.Net Core 2.0 to 2.1: 'IMutableEntityType' does not contain a definition for 'Scaffolding'

We have a .Net Core 2.0 API using a psql database.
When updating to .Net Core 2.1, it stopped building and returned the following error:
'IMutableEntityType' does not contain a definition for 'Scaffolding' and no extension method 'Scaffolding' accepting a first argument of type 'IMutableEntityType' could be found (are you missing a using directive or an assembly reference?)
This extension methods was not intended for external use, but we need it to change entities schema at runtime.
It's a one liner, but it took me some time to find that I had to change
builder.Entity(type).Metadata.Scaffolding();
to
builder.Entity(type).Metadata.Relational();
I hope it can help someone.

Building Autofac from sources

How to build Autofac from sources? I found only one deprecated wiki page.
I've tried to launch go.cmd (.NET Framework 4.0), but it failed with errors:
C:\Autofac\Autofac.csproj" (default target) (4) ->
(CoreCompile target) ->
Builder\MetadataConfiguration.cs(28,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
[C:\Autofac\Core\Source\Autofac\Autofac.csproj] Features\LazyDependencies\LazyWithMetadataRegistrationSource.cs(28,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
What I am doing wrong?
Autofac 3.0 has been updated so the core Autofac.dll is a Portable Class Library that targets multiple platforms. Portable Class Libraries don't have references to System assemblies so the missing System.Core reference is correct - it shouldn't be there. You should be able to use the Portable Class Library with .NET 4... or with Windows Store or Windows Phone 8 apps. I strongly recommend not modifying the references for the .csproj. You'll break that compatibility and inadvertently change the target profiles.
The wiki page on building from source has been deprecated because the instructions for building are in a readme right in the root of the source code. (That's mentioned on that deprecated wiki page - first line.) It explains all the prerequisite tools and commands required. If you follow the information in there, you should not have to modify anything to get the source to build.
If you aren't modifying the sources, I'm not sure why you'd need to rebuild the source to target .NET 4 specifically. It should just work. If you see something that isn't working, please file an issue about it on the Autofac site.
If you are modifying the source, the readme in there should get you building without messing with the project references.
It looks like the Autofac.csproj does not include a reference to system.core. See also this question and this bugreport. So can you try to add this to the Autofac.csproj file:
<ItemGroup>
<Reference Include="System.Core" />
</ItemGroup>
Possibly you also have to add other references, such as System.

LINQPad 4 unable to find EntityFramework

I'm trying to use LINQPad 4 (the latest beta) with Entity Framework POCO classes. I take the normal path of creating a new connection and then selecting "Entity Framework DbContext POCO(4.1) and then selecting my he assembly holding my classes. When I do so I get the following message
"Could not load file or assembly EntityFramework. Version=4.1.O.O,
Culture= neutral, PublicKeyToken=b77a5c561934e089 or one of its dependencies.
The system cannot find the file specified."
I'm able to load the assembly from my application just fine. What gives? It seems a bit different from the previous problem like this reported in the CTP.
I had the same problem today, this is how I solved it:
Apparently the LINQPad 4.36.3 requires in some way Entity Framework 4.2 :/
It was released last week: ADO.NET blog
What I did is:
Installed EF4.2 via NuGet
Rebuilt the project
Copied all my project .dll files to LINQPad folder (including the 4.2 EF.dll)
I read here that I need to add something to the LINQPad.exe.config file but it was already there..
[At this point I tried removing that assembly redirect and ran it against my 4.1 dll, did not work, was still looking for 4.2]
Closed VS and uninstalled EF4.1
Thats it, after that both my project is now running on 4.2 and LINQPad works as well.

Telerik MVC Extensions deployment problem

I am writing a website which uses Telerik MVC Extensions, and am getting an error on my test server when I get no such error on my development PC.
The error is ...
Web.config(101): error CS0246: The type
or namespace name 'Telerik' could not
be found (are you missing a using
directive or an assembly reference?)
Here is the relevant line from the web.config file ...
<add namespace="Telerik.Web.Mvc.UI"/>
I have checked the bin folder on my test server and it does contain the Telerik.Web.Mvc.dll file. The test server is 2008R2.
Have I missed something really obvious here?
Do you have multiple applications in your website? In other words, do you have multiple web.config and bin folders?

Error compiling pre-generated view in VS 2008

I am created pre-generated views for my EDMX using VS 2008, .NET 3.5 and Entity framework.
I have generated using the t4 templates mentioned here and got my mymodel.views.cs file. It's around 40 mb is size.
Added the views.cs file to my web application and my web service. When i build the apps, the webservice would build without any error and i can get the WS to work. But, the build fails in the website with the error
error CS0234: The type or namespace
name 'Mapping' does not exist in the
namespace 'System.Data' (are you
missing an assembly reference?)
The System.Data assembly is referenced in both the projects and the version denotes .NET 2.0. Suspect something trivial i am missing here, but still clueless.
Any pointers would help!
Add a reference to System.Data.Entity.dll, which contains the System.Data.Mapping namespace.