HI I have this MVC4 internet application that have to access to the postgres server. I'm lack of budget so cannot afford commercial ado.net driver for postgres server. I had a look on npgsql but unfortunately it does not support entity framework 5. So I was wondering is that possible to wrap ado.net connection string as ODBC? If it's possible? does it also possible to use entity framework with that? please give me some advice. Thank you
No you can't
You can get a detailed explanation there Why doesn't EntityFramework support ODBC
Under a 100$ you can get some nice commercial ADO.Net drivers. Personally I've used dotConnect (For SQLite) but probably that their ProgreSQL package must be as good. You should give it a look. Also they have a 200$ license that can do ODBC.
Related
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'm writing an application, following the repository pattern, that uses Entity Framework 5. So, I have my own DbContext class already, but it currently just uses the default Sqlite local database. I'm now trying to figure out how to introduce Devart's dotConnect for Postgres into this and make my DbContext connect to and use postgres. It looks like dotConnect provides support for this, but I can't make sense of their examples.
Are there any basic, working examples of this anywhere? I've seen a few but they're all pretty complicated looking and the code is too messy for me to comprehend just the basics. Is there maybe a good explanation of what to do at the most simple level?
We have answered you at the Devart forum: http://forums.devart.com/viewtopic.php?f=30&t=28113.
I have to develop a desktop windows application in C#.Net 4.0 that will run in three different databases ie. MS Access 2007 onwards, Oracle 11G, and SQL Server 2008. Now I want to use Entity Framework in my application. Is this a best choice to use EF for my application ?
If yes, then how can I use entity framework for Access database?
Thanks in Advance.
You can use the EF with Microsoft Access using an Entity Framework provider for Microsoft Access.
You can find an EF provider for Access
https://github.com/bubibubi/JetEntityFrameworkProvider
See this answer. Ask yourself why you need Access, could you use SQL Express instead? If you absolutely need Access then it would seem EF is not the right choice in this instance.
Putting Access to one side for the moment, it's perfectly possible to change data providers with EF (particularly code-first) as EF abstracts a lot of the database goo away from your code; depending on the database design it could be as simple as changing the connection string dynamically. The practical implications of this really do depend on your database design and the nature and complexity of the application you are building. See this question for example, here's another example.
We use Dapper as our ORM with repositories when working with MS Access. It's fantastic.
Last time I used Npgsql, i.e., version 1.0, it worked very slow. Is there any other alternative to Npgsql?
Version 1.0 is three years old. Try to use the newest one.
Npgsql is an excellent connector. Just upgrade to the new one. Make sure you take a look at the documentation it is really good. That will solve the speed issue.
You asked about an alternative, so I also have to recommend an another good connector: dotConnect for PostgreSQL. It is made by Devart. There is a simple free one as well as a fully robust pay connector. The pay one has Linq and entity framework support.
http://www.devart.com/dotconnect/postgresql/
I have experience with the .NET MySQL connector. What you are describing seems to be a DNS issue. If you are using a URL in your connection string and are able to change it to an IP address, try that and see if your delay goes away.
npgsql is still the choice for .NET when connecting to PostgreSQL.
Since version 1.0, the connector has improved drastically, check out this presentation from Shay Rojansky; it is not the latest, still the boost was already quite impressive in 2018/11.
If you are upgrading from an old version, read the release notes of the latest carefully, you might break functionality in your code.
Also, I strongly recommend considering optimizing PostgreSQL as well. I work with it daily in a distributed enterprise environment, with massive workloads; it can be tuned and tweaked with a dramatic impact on the overall performance.
As #yojimbo87 told upgrade to newer connector version. Try that.
Use entity core framework. Npgsql has an Entity Framework (EF) Core provider.
Use Postgres 11
Check connection pool setting
Like most ADO.NET providers, Npgsql uses connection pooling by default. When you Close() the NpgsqlConnection object, an internal object representing the actual underlying connection that Npgsql uses goes into a pool to be re-used, saving the overhead of creating another unnecessarily.
This suits most applications well, as it's common to want to use a connection several times in the space of a second.
It doesn't suit you at all, but if you include the option Pooling=false in your connection string, it will override this default, and Close() will indeed close the actual connection.
Npgsql has an Entity Framework (EF) Core provider. It behaves like other EF Core providers (e.g. SQL Server), so the general EF Core docs apply here as well. If you're just getting started with EF Core, those docs are the best place to start.
Development happens in the Npgsql.EntityFrameworkCore.PostgreSQL repository, all issues should be reported there.
https://www.npgsql.org/efcore/index.html
Has anybody tried to use EF provider (.NET 3.5 SP1) for Firebird (embedded server in my case) in production?
Can it be considered stable enough for commercial development?
I can't say about the Entity Framework but I do use the Firebird .net Data Provider on production and it's rock solid.
It's work fine. I hadn't got bugs in work with this firebird and entity framework. I develope huge application now and use that products very active. I didn't see bugs in firebird .NET provider, but i saw little bug in entity framework. I have only one problem - to install firebird for using in Entity Framework and make settings. It can take about one working day. So after it you can use this product quietly.