Generating SQLite Database from Model at VS 2015 & EF7 - c#

I'm trying to make Windows Presentation Foundation application, utilizing Entity Framework 7 & SQLite Database File. I've made *.edmx model, but when trying to generate model i can't make SQLite Connection. Tried everything from https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki but nothing helped, still no option for creating proper connection.
There was already similar question - VS 2015 SQLite data provider - but it was few months ago. Have anything changed? Is there any way to connect EF7 on VS2015 to SQLite?

You need to download a setup package from the SQLite.org.
The only one I got it working with was sqlite-netFx46-setup-bundle-x86-2015-1.0.98.0.exe (The 64x version didn't do it).
You might also want to get the "SQL Server Compact/SQLite Toolbox" extension for Visual Studio (Tools/Extensions and Updates..). With it you can export tables from MS Sql (beta) among other things. It does work for most tables, had difficulties for tables with multiple primary keys in them (composite keys) though.

Related

Using the ADO.NET Entity Data Model and an ACCESS Database?

I'm using:
Visual Studio 2013
.NET Framework 4.5.1
Microsoft Access 2010
I'm currently working on a C# school project that doesn't require us to use a database at all, however we can grab some extra credit if we implement a database.
I've worked with SQLite so far and had not much trouble setting up the connection, however we are limited to Access for the project.
I would like to use the database in an ADO.NET Entity Data Model, but upon trying to add the .edmx Item via the solution explorer it doesn't let me choose "Access Database".
Is there any way to get an Access Database and the EDM to work together?
There is a JetEntityFrameworkProvider available on github. Compile the code and run the Install.cmd from JetDdexProvider folder:
To get DDEX Provider installed.

Connecting to MySQL in VS2017 in ASP.NET MVC 5 project

I'm new to ASP.NET and MVC, trying to move from WinForms. I'm using Visual Studio 2017 Pro, and I am trying to follow some tutorials for connecting to an existing MySQL database. I plan to use the Database First method as the database already exists. I have the following config :-
Windows 10 Pro 64 bit on my PC
VS 2017 Pro
MySQL for Visual Studio 2.0.5
MySQL Connector 6.10.4
EntityFramework v6.2.0
Mysql.Data 6.10.4
Mysql.Data.Entity 6.10.4
Mysql.Web 6.10.4
I can make a database connection using the Server Explorer, but when I'm using the EDM wizard to create the model from the database, the connection isn't showing in the drop-down box, and if I try to create a new one, the MySQL driver doesn't show as an available option, only SQL Server.
I've tried various combinations of MySQL for VS, MySQL Connector, EF and MySQl components (older versions) but I can't seem to find a winning combination.
Has anyone managed to achieve this ? I'm pulling out what's left of my hair. Thanks.
enter image description here
OK I finally found an answer, I now have EF 6.1.3 and MySQL Connector 6.9.9 installed.
I needed to change the part of the Web.Config file as described by James Wilkins in this post.
Thanks to Panagiotis for your help.

What does this error means? 'Oracle.ManagedDataAcess.Client'

I just get project from my friend for learning some stuff, the project is simple windows forms application made in Visual Studio (VB as code behind), he moved the project to my machine and we run the project without any problems, it connected to the database and we get results from DB loaded into grid.
But when I tried to edit some stuff on the project like adding new DATASET I received this error, and even when I want to add new QUERY in TABLE ADAPTER or if I want to see the code of existing dataset I am receiving again the same error.
This means I am missing some DLL's in my visual studio?
When You create the application and it should connect to some database system, it needs to have a negotiator between the App and the Database. For this purpose You must use some DataAccess provider.
There exist multiple versions for all the Databases (MySQL, MS-SQL, Oracle DB, Postgree...). As the DB syntax is evolving (the language), also the versions of DataAccess providers are increasing.
Basically each DB requires some minimal version of provider to work with. As Your computer does not have any valid installed, it throws errors. The best You can do check what version is used by Your colleague and download the same or higher from the Oracle web.

Connecting ado.net Entity data model to postgresql database

I'm new to C#, ado.net and visual studio 2012, just to make that clear from the beginning.
I'm trying to connect an ADO.NET Entity Data Model to a postgresql database.
I tell VS to 'generate mdoel from database' and click to make a new connection. Postgresql is not listed as an alternative data source (I can only see different microsoft mysql sources).
I did download the npsql .dlls and put them in the projects\ folder. I then added them by PROJECT->Add Reference->browse, check them and press ok.
Postgresql does still not appear as an alternative when I try to make a new connection.
In advance, thanks!

SQL Server CE distribution

I have spent several days trying to solve this problem with no luck and my requirements are really simple - I want to make an application with database which will work on most PCs (without DB server installed) and I want to use LINQ. For the compatibility reasons I want to use .NET framework 3.5 (every Windows 7 machine has it).
I have tried 2 ways: SQL Server CE and SQLite.
SQL Server CE
Although Visual Studio does not support LINQ for Compact Version of SQL server, I have found simple workaround - generating .dbml file using metal.exe tool from Visual Studio and then dragging it into project. My application works fine on my machine, but when I copy it somewhere else, it crashes. I have copied all dlls from C:\Program Files (x86)\Microsoft SQL Server Compact Edition\3.5 and tried 4.0 too. I think problem is that my app is not looking for dlls (references) inside its directory. I managed to get it work using DataSets (without LINQ), where I manually add reference to SQLServerCE and check CopyLocal to true. BUT when I use LINQ, there is no reference to SQLServerCE in project references and it is working. I don't know how to change it. Or is there a problem somewhere else?
SQLite
After long messing with SQL Server CE, I have tried SQLite. I am very disappointed how poor is SQLite support in .NET. I had to download older version of ADO.NET provider (newer versions does not add SQLite Database into my Visual Studio 2010 - I don't understand why but I googled that it is normal and I have to install old version and then replace it with newer). Then I downloaded dblinq (I have discovered that this project is dead later) and after some messing with dbmetal and dlls I get rid of errors in Visual Studio and compiled my application. But I can't run it, it always crashes on error 40 - like there was no SQLite server. Of course I have copied all dlls. I can't run it even on my development machine.
I am very surprised that it is nearly impossible to create simple database application in C# .NET which will not bother client with servers etc.
Please is there anyone who made SQL CE work with LINQ and mainly who made his app distributable?
I would suggest you try using the nuget Entity Framework for SQL CE package. It will download all the required assemblies to make it work.
http://nuget.org/packages/EntityFramework.SqlServerCompact/

Categories