Is EF Core 3 still incompatible with SQL always encryption? When I add enable Column Encryption Setting=Enabled to my connection string in appsettings.json my application crashes.
I'm using EF throughout my application and switching to SQLclient is not possible to me.
Related
Is it possible to deploy / install Entity Framework Core 2.0 alongside traditional Entity Framework 6? Is it fully possible, or possible but with some hang-ups, or not possible? Is this documented somewhere? I think I've seen they said they designed it to be side-by-side, but I'm having a hard time fully confirming this. Thanks.
The official documentation says the following:
It is possible to use EF Core and EF6 in the same application. EF
Core and EF6 have the same type names that differ only by namespace,
so this may complicate code that attempts to use both EF Core and EF6
in the same code file.
If you are porting an existing application that has multiple EF
models, then you can selectively port some of them to EF Core, and
continue using EF6 for the others.
This means of course that you can install both EF6 and EF Core in the same project. I have done this in a few simple cases myself and it was working ok.
I have a .NET WPF project which is using SQL Server CE 4.0 with Entity Framework.
I want to rework it into a Xamarin Forms project. I think the 'migration' of the backend will be almost seamless, except for the data access layer. I am confused as to what Xamarin supports. I can't use SQL Server CE with Xamarin forms, can I? What about SQLite? It is supported, as far as I can tell.
Ok, but then what about ORM? Right now I am making a heavy use of the EF navigation properties. Is there any way I could preserve this with SQLite?
How would you go about converting code which relies on EF and navigation properties, backed by SQL Server CE, to SQLite, while preserving the mentioned navigation properties?
Can I use Entity Framework with SQLite, on Xamarin Forms?
EF Core supports SQLite, yes.
And SQL Compact is supported with EF Core, but only on Windows desktop.
Support for EF Core with Xamarin Forms is still in progress, see this: https://learn.microsoft.com/en-us/ef/efcore-and-ef6/features
I have a Asp.Net webapi 2 system that works with sql server. I developed it using entity fraework 6.1.3 code first data models and fluent mappings with the typical workflow of add-migration/update-database. I love it.
I have a need to create the exact same software with a lighter weight db to run on a raspberry pi device. It's the disconnected version of the software that will replay/resync all of its data to the cloud version (sql server).
I realize I may need to relax some of my constraints, but starting at the extreme, I would like to target the exact same code base with something like sqlite and xcopy deploy it to my raspberry pi and run in on mono under kestrel web server.
Ideally, I'd just like to change my connection string to point to an empty sqlite db, do a update-database and have the exact same software initially run on my windows development box (and then xcopy it over).
I have read a lot about sqlite entity framework support but a) it doesn't seem to support migrations b) it doesn't seem to support fluent mapping
I could get by using a tool to convert my sql server db to sqlite (every time I change schema) and thus avoid the need to update-database. But the lack of fluent mappings would still prevent the data model to be properly mapped to the existing sqlite schema.
Does anybody have some thoughts/recommendation for sqlite that my help me accomplish my goals?
Do you have any other database recommendations that would help me accomplish my goals - for instance I looked at vistadb, but I don't think they support fluent either.
The devart sqlite driver seems to support everything I need but their examples are all old school and AFAIK they don't have one single example that is a modern code first model with fluent mappings. And even if they did fully support code first wth fluent I am concerned there would be some syntax differences and I am not sure my existing sql server targeting code would be compatible with it. I asked the question on their forums and sent an email but haven't received a response yet.
Thanks
You could consider using EF7, which is a API compatible new version of Entity Framework, that fully supports migrations and fluent mappings with SQLite. EF7 runs on .NET 4.6 and .NET Core. Depending on what features in EF6 you use, it could be an easy upgrade, in particular since you already use Code First.
http://ef.readthedocs.org/en/latest/getting-started/linux.html
I am using Entity Framework (EF) 5.0, Code First approach, and SQL Server CE 4.0 database in my application. However, I am facing a major performance problem on application start-up.
I searched on the Internet and found this article which explains which operations affect start-up performance, and one of them is view generation. So, I looked into how I could generate views at compile time and link them to EF at run-time instead of creating views at run-time. I came across Entity Framework Power Tools which provides a command to generate views through your DbContext class.
I have generated the views at compile time using Entity Framework Power Tools as described in this article. However, when I run my application with SQL Server CE it always generates the following exception:
The mapping and metadata information for EntityContainer 'DatabaseContext' no longer matches the information used to create the pre-generated views.
whereas the same application works fine with SQL Server database. So, I searched more but have not found a fix to this problem. Following are links where people have reported similar performance problems:
MSDN Blogs
Entity Framework forum on MSDN
My question is this: "Is there a workaround or solution for this application start-up performance problem?". I need to use SQL Server CE and not SQL server.
Actually EF Power tools were generating the view using the default provider SqlClient but, I needed to generate the views for SqlServerCe.4.0 provider which, I was unable to figure out why every time generated views goes out of date and finally I figured out why it was not working.
So, I just commented the DbContext constructors from my context class and, then I ran the "Generate Views" and "View Entity Data Model XML" command of EF power Tools, then EF Power Tools took the connection string from App.config otherwise it uses a default connection string that connects to Sql Server with SqlClient as provider.
So, I believe that if anybody uses any other provider like Devart's Oracle provider etc., then he/she needs to generate the views by specifying the connection string and provider information in App.config (for desktop applications) or web.config (for web applications) and comment out the DbContext constructors (or hide it from EF Power Tools using per-processor).
I want to implement Data Access Layer in Entity Framework in a way that one can switch from excel to sqlite or ms access of ms sql server using a single setting in web.config.
Is there any good suggestion or example for this available?
List of allowed providers for Entity framework is here. As I know Excel and Access are not supported.
When using EDMX file you must change provider in both connection string and SSDL. SSDL is by default included in assembly as resource so if you want to change provider you must change this behavior and use external SSDL stored in application folder.
For setting provider for Code-first check this question but be aware that not all features are supported when working with Code-first and DB other then SQL Server or SQL CE.
I would suggest the use of Inversion of control (IoC) and interfaces, then check the config when setting up the IoC container.