Entity Framework MetadataWorkspace error - entity-framework-5

Using a Code-First approach with Entity Framework 5 for a Silverlight to WCF RIA Services project. During solution build, I receive the following error and warning:
Warning
No persistent classes found. Is the metadata information missing?
Error
Failed to get the MetadataWorkspace for the DbContext type
I'm running off a local Database, and placed the custom connection string information in the constructor for the DbContext.

Related

.NET Core Keyword not supported: 'server'

The sample application on the following page does not start.
https://learn.microsoft.com/en-us/azure/app-service/tutorial-dotnetcore-sqldb-app?pivots=platform-linux
https://github.com/azure-samples/dotnetcore-sqldb-tutorial
As stated in the documentation
After downloading the sample application and creating the DataBase to connect to, an error will occur when the database migration is executed.
$ export ConnectionStrings__MyDbConnection="Server=tcp:db-host.database.windows.net,1433;Database=coreDB;User ID=<username>;Password=<password>;Encrypt=true;Connection Timeout=30;"
$ dotnet ef database update
Build started...
Build succeeded.
info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 3.1.3 initialized 'MyDatabaseContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: None
System.ArgumentException: Keyword not supported: 'server'.
at Microsoft.Data.Sqlite.SqliteConnectionStringBuilder.GetIndex(String keyword)
at Microsoft.Data.Sqlite.SqliteConnectionStringBuilder.set_Item(String keyword, Object value)
at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
at Microsoft.Data.Sqlite.SqliteConnectionStringBuilder..ctor(String connectionString)
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.Exists()
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Keyword not supported: 'server'.
Do you know the cause?
I'm using .NET Core 3.1.
If your intention is really use SQLite then you should check this patterns of connections string:
https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/connection-strings
If not, your code is accidentally calling the SQLite extension to configure your DbContext... Do a full search (Ctrl+Shift+F) in the entire solution for UseSqlite method and replace it for the desired database provider extension (probably will require a new package reference to your project)
The cause was that SQlite was specified where SQL server should be specified.
services.AddDbContext<MyDatabaseContext>(options =>
options. UseSqlite(Configuration.GetConnectionString("MyDbConnection")));
services.AddDbContext<MyDatabaseContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("MyDbConnection")));
Thank you for your cooperation.

azure entity framework issues with error code Unknown error: 0x80070057

I having issues with entity framework on Azure Database, I can open up the models and update the database entities but when I try to run the application the first data call get error Entity Framework is throwing an error “Unable to evaluate the expression. Operation not supported. Unknown error: 0x80070057.”
I'm thinking if I can open the model up and update the entities i have the correct permissions.
I'm not getting the same issues when running localhost with localhost database.
Thanks

Breeze DTO Service -- Metadata query failed for: breeze/DTO/Metadata; An error has occurred -- Error

We are using Breeze in our SPA (Durandal), till now we were using EF5 to return the metadata Breeze requires, but now we want to use DTO in certain scenarios, so we have implemented it following http://www.breezejs.com/documentation/ef-design-tool, it works well in development environment but when we deploy it on IIS it returns "Metadata query failed for: breeze/DTO/Metadata; An error has occurred."
I have checked the paths to the service is correct.
Please help....
I was able to resolve the issue the root cause was that an dummy connection string is required for DTO to work especially in the case if Webdeploy is being used to publish the code. I referred the Breeze Sample "DocCode" web config --
<!-- TODO: is this needed?
phony FoosMetadataContext connection enables FoosMetadataProvider to succeed; there is no nonsense.sdf-->
<add name="FoosMetadataContext" connectionString="Data Source=|DataDirectory|nonsense.sdf" providerName="System.Data.SqlServerCe.4.0" />

Unable to find the requested .Net Framework Data Provider. It may not be installed

I am using Nlog and in my controller i am writing the following line
static readonly Logger Log = LogManager.GetCurrentClassLogger();
and its throwing the error "Unable to find the requested .Net Framework Data Provider. It may not be installed."
Please help...i am a newbie to Nlog
this error resolved. The problem was the connection string mentioned the provider as EF and the nlog can only work with SqlClient. so i created a seperate connection string for nlog.

'ViewBag' It may be inaccessible due to its protection level

MVC 5 vb web application
I created a entityFramework migrations where I have a class library for data entities and combined it with the AspNet Identity within the web application. No error so far. I created a IndentityDB that has the defaultConnection and updated the AccountController to point to the connection
(New UserStore(Of ApplicationUser)(New IndentityDB())))
seems to be right with no error on the build except for a enum issue in the classlibrary that I will fix later but I get a error:
'ViewBag' is not declared. It may be inaccessible due to its protection level.
A first chance exception of type 'System.InvalidOperationException'
occurred in System.dll A first chance exception of type
'System.Web.HttpException' occurred in System.Web.dll 'iisexpress.exe'
(CLR v4.0.30319: /LM/W3SVC/32/ROOT-1-130360312907627858): Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Services.Design\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Services.Design.dll'.
Cannot find or open the PDB file.
This error happens when I try to login on the home page and any other Authorized Controller

Resources