App.config settings for EF5 codefirst and SQL CE - ef-code-first

I'm having trouble building a small console app with just a couple of classes using EF5 and code first with a SQL Compact database. Apparently there have been some changes with the latest version of EF that may be getting in my way. Could you point me to a resource that would properly cover the changes needed to the app.config and if needed machine.config in my project?

Just use the EntityFramework.SqlServerCompact NuGet package, it will add all the required config setting for you.

Related

ASP.NET 4 - How to generate asp.net identity schema for database in SQL?

I am using VS2019 16.10 to create an ASP.NET 4 application (.Net 4.7.2 - not MVC) and have set the option to use local authentication. After generating the application it has not created the schema for the asproles, aspusers etc. tables in the database.
I have enabled migrations but all that got created is an empty seed() function in the migrations directory.
The NuGet package that was installed is Microsoft.AspNet.Identity.EntityFramework v2.2.3
Does anyone have a link to a SQL script that creates the schema?
I have tried a couple but get errors with missing columns.
Regards.
Well, assuming you are running sql server x64, which is likely?
Then this path should work:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe
The solution that I found the closest to work was to create a basic asp.net 2.1 project in Visual Studio which generated the migration. I was then able to use the Package Console Manager to generate the database schema that could be run in SSMS.
The only issue was a missing column in the AspNetUsers table LockoutEndDateUtc which I added manually.

Having trouble referencing .NET Standard class library using SQLProvider from .NET Core project

Reproduction of problem here: https://github.com/Arrow7000/SqlProviderTest
I'm fairly new to the .NET world so am having trouble wrapping my head around exactly what the problem is.
I've tried to use the SQL type provider directly in an F# .NET Core project, but had a bunch of problems getting it to work. From what I can tell that's due to incompatibilities between .net core and type providers.
So what I am trying instead is to have the SQL type provider code encapsulated in a .NET Standard project that I can reference from my main Core project.
I've managed to reproduce the problem in a minimal GitHub repo located here which demonstrates both that
the type provider is working in Visual Studio 2019 with IntelliSense, but
despite this I still get a build error when I try to start the Main project
The build error is
Unable to find the file 'C:\projects\SqlProviderTest\SQLStuff\bin\Debug\netstandard2.0\SQLStuff.dll' in any of
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\ref\netcoreapp2.2
C:\projects\SqlProviderTest\Main
C:\Users\Aron\.nuget\packages\fsharp.core\4.6.2\lib\netstandard1.6
Why isn't the project reference simply working as expected? I've tried adding <Private>True</Private> to the project reference but that didn't make any difference
P.S. in case it matters, I'm developing on Windows but the app gets deployed on a Docker container.

Does Fluent Migrator work with .net core app?

I am trying to use Fluent Migrator with .net core2 application with no success (i did had a success with using Fluent Migrator with .net framework application).
What i did is the follow:
Created a new Class library project in the solution.
Added Flunt-migrator, ver 3.1.3
Created classes that inherit from Migration class.
implement the Down() and Up() functions.
located the Migrate.exe file under windows Users folder
in the migration project properties window, updated the build output path to the path of the Migrate.exe file.
ran build on the project, but the tables wasn't created under the
data base tables.
did i missed something?
This post would suggest that yes it does work, I don't have a huge amount of experience with fluent migrator but if i had to guess I would suspect the issue is that you are referencing a .exe rather than import the nuget packages
Fluentmigrator do support .NET core. All you just need to do is to follow their quick start guidelines. Documentation Quick Start

Difference between EF.SqlServer and EF.SqlServerCompact

I want to install Entity Framework in my ASP.NET 5 MVC project using project.json.
In the dependencies section I start typing EntityFramework and I only see
"EntityFramework.SqlServerCompact": "6.1.3" instead of "EntityFramework.SqlServer": "6.1.3".
What is the reason for this and what effects will this have?
Are there limitations in the compact version?
If I create a new ASP.NET 4 project with MVC and install EntityFramework then I see the EntityFramework.SqlServer reference installed and not the compact.
EntityFramework.SqlServerCompact is for interacting with SQL CE. It's a single file based database. If you're dealing with MS SQL Server, that's definitely not what you want. You want EntityFramwork 6.1.3, there is no EntityFramework.SqlServer.

ASP.NET vnext and open database

is there some possibility to work with an open database like mysql, mariadb or other and ASP.NET vNext?
Perhaps a beta driver or something like that?
For ASP.NET vNext you can choose to target the full .NET Framework or a slimmed down, bin-deployable, cross platform, Core framework.
If you target the full .NET Framework then you get all the data access options you had before. If you target the CoreCLR then you can use the new version of Entity Framework (EF7). Currently we have the following providers available on CoreCLR; SQL Server, SQLite, and an in memory provider for testing. Of course, more providers will become available as we work towards RTM.
In addition to EF7, there are also the corresponding provider specific SDKs that EF is building on top of, and these can be used in application code as well (e.g. there is an implementation of SqlClient that can be used to access a SQL Server database).
You can read more about our plans for EF7 here - http://blogs.msdn.com/b/adonet/archive/2014/05/19/ef7-new-platforms-new-data-stores.aspx.
It depends on if you are using the CoreCLR (the trimmed down version) or the Desktop profiles. In the Desktop profile you have everything you have in .NET available and you can add your own open source libraries (via Nuget).
Just open up your project.json and add the needed dependencies.
Anyway you should not be dealing with low level ADO.NET, you can use Entity Framework, or Massive or nHibernate, or whatever, to abstract away the specific database your project is using now, as it is bound to change or multiply during the project lifetime...
You should still be able to use anything ADO.Net related with ASP.Net vNext - it is, after all, still .Net!
Yes, it is possible, but only if you use full .net profile (on windows it will be .net framework and on linux - mono). NHibernate working well on mono, so you can eventually use mysql, postgresql and other databases in you APS.NET 5 vNext application. Here is complete example of application with NHibernate and PostgreSQL on Ubuntu server.

Resources