How to get Npgsql working with EF4? - postgresql

hey I know it's an old question but I'm a little stuck trying to even get Npgsql to work with EF4 at all! I can't seem to register the provider wherever it needs to go in order for it to show up in the the Entity Data Model Wizard.
When trying to create a new model, I try and create the connection to the Postgres database in the "Change Data Source" dialog. But the only providers in here are differing flavours of MSSQL and "". The data provider combo on this form doesn't show Npgsql or anything postgres related.
I have already done the usual of registering npgsql and the mono security assemblies in the GAC. I've modified machine.config (32 and 64bit) to have the provider factory entry required.
I'm using VS2010 SP1 on Windows 7 64bit & Npgsql 2.0.11.92. I'm developing for .NET4.
Any ideas of how to get this working would be much appreciated.

Unfortunately Npgsql doesn't have support for VS Wizards.
We have a very early work in progress which you can give a try.
Checkout our downloads page and look for the Npgsql.Provider.zip file.
Follow the install instructions there and let me know if it works ok for you.
Again, sorry for the lack of support.
I hope it helps.

Related

Entity Framework 6, Postgres (npgsql) and EF Power Tools

I have some trouble using the EF Power Tools and I searched now for several days but I didn't find any solution for my problem.
Maybe someone has a new idea or hint for me. My problem is that when I want to create a Preview Data Model VS says that it couldn't find the required ADO.NET driver. I'm working with Postgres and EF 6.
It worked several days before but, as far as I can see within my source control nothing important changed. So I started to search for a solution and tried several things. I guess it has something to do with my app.config but I have no idea what I'm exactly missing there.
The app it self runs great and also the connection to the db works fine, only the EF power tools seems to have a problem.
It would be great if anyone could help me.
Regards Alex

Visual Studio 2013 and Entity Framework

I'm using VS 2013 and SQL Svr 2012 and trying use EF to populate a gridview. As this is a very simple test, I have just one table with a key and a couple of data fields. The process of creating the model seems to work fine - it shows as expected in the designer view, the files are created in app_code, a bin folder is created with 2 dlls, and the config file is updated with a connection string and other entries.
When I try to select the "named connection" I get the error "Unable to load the specified metadata resource" and it talks about rebuilding the project to get the assemblies.
I've spent hours reading other cases like this and I can't understand:
Why this is happening when it was never a problem with VS 2010
How do I fix the connection string to point to the resources it wants. I'm totally lost with all the technical advice about fully qualified assembly names - nothing I try works.
How do I set some parameter to force the resources to be in the proper place? All the advice I've read doesn't seem to relate very well with VS 2013
I need to decide if I should just uninstall VS 2013 and use VS 2012. Currently, I'm using VS 2010 with ASP 4.0 and I'd like to move to ASP 4.5 and generally keep up with Microsoft technology. However, I don't have the skill level to deal with a VS release that is buggy. It seems to me that this EF execise could be due to a either a bug or some odd corruption on my computer - I'm trying to figure out which is the case. I installed VS 2013 Express and SQL Svr 2012 on a clean machine that had none of these tools in the past.
I'd really like to see someone who is very familiar with Visual Studio try to replicate my problem as it only takes a few minutes to do so:
In MS SQL Server, create a tiny DB with one table that has a primary key and a couple of data fields and populate with some test data - Call it TinyDB with TestTable1.
Using VS 2013 Express for Web, create an "New Web Site" with the option for "ASP Empty Web Site" using VB.
Add an ASP App_Code Folder containing an "ADO.Net Entity Data Model" and leave the name as "Model".
Generate the model from the DB and make a "New Connection" for "TinyDB" and using Entity Framework 6.0 and then select "TestTable1". Note the namespace is "TinyDBModel". Clicking "Finish" will generate several items in App_Code, other folders and also update web.config.
Add a web form called default.aspx and drag a gridview onto it. In design mode for the gridview, select "new data source" and then the "Entity" option (note name of EntityDataSource1 which appears in default.aspx). Click next and under "named connection" select "TinyDBEntities" - this is where mine gets the error "Unable to load the specified metadata resource".
Note that this exact exercise in VS 2010 works perfectly and produces a grid with the correct data displayed.
Unfortunately, the EntityDataSource control does not work with the latest version of Entity Framework, EF6. Hopefully the control gets an update in a future update version of VS or EF, but for now you can't use the two together.
There are a few solutions / alternatives:
Drop back to EF 5. In order to do this, delete the .edmx and .tt files from the App_Code folder, delete the EF assemblies from the Bin folder, and remove the references to EF from web.config. Then rebuild the site, add a new ADO.NET Entity Model and choose version 5 in the Choose Your Version dialog. Then delete the .tt files from the App_Code folder, open the EDMX diagam, right-click an empty spot and on the Properties Grid set Code Generation Strategy to Legacy ObjectContext. Then rebuild again, and it should work.
Use Model Binding. This is really the recommended solution. The Microsoft / EF team recommends people to stay away from the EntityDataSource control and only use it for Dynamic Data web sites, Model Binding is the preferred solultion. It's pretty clean and straight forward to use, and gives you a lot of control over your queries and object updates. For more info about Model Binding, check out: http://www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data

Entity Framework with Oracle

I have installed the ODAC 11 and I would like to use it with EF Database First but it doesn't appear in the "Choose Data Source" dialog just the SQL Server providers.
I don't know how to go further.
I need a little help, please.
I'm not sure what you installed, but this has support for Entity Framework. I've used it before with no issue.

How to upgrade OpenERP 5.0 to 6.0

I have an OpenERP 5.0 installation with a few custom modules, that I wish to upgrade to OpenERP 6.0.
I have some experience with this kind of sofware and I have inspected OpenERP. Sadly, I don't have actual experience with OpenERP, and I like to ask for some help in order to avoid mistakes. When researching this, I found there are several strategies (ETL processes, data-upgrade modules)... I assume I'll need to review all custom modules.
What are the guidelines or best practice in order to upgrade an OpenERP 5.0 installation to 6.0?
We're still planning our migration from 5.0 to 6.0, so I don't have any personal experience with the process. We are planning to tackle the work ourselves, but we've done a lot of custom development, so we're pretty comfortable with the OpenERP code. If I were inheriting the system from someone else as it sounds like you are, I would be very tempted by the support contract that includes doing migrations for you.
In addition to the paid service, there also appears to be an open-source tool available for running data migrations. It is also discussed in several forum posts. (There really are a lot.)
Our tentative plans are:
Try out the migration tool for a demo database from plain 5.0 to plain 6.1.
Migrate the code for our custom modules to 6.1, following the Pragtech guidelines.
Extend the migration tool's configuration to cover our custom modules and any others that weren't included with the tool.
Run the migration on our full database into a sandbox and test the heck out of it.
Launch and celebrate!
Update:
We've started our migration process, and we're using OpenUpgrade instead of the Domsense tool. We never really looked at the Domsense tool, so I can't say which is better. I'm very happy with OpenUpgrade so far.
In general, I've found version 6.1 much easier to customize than 5.0 was. So far, I haven't had to change any core modules. For example, most places where a core module inserts a record, it calls a helper method to prepare the data. If you add a new column that you want to be populated, you can just override that helper method. For example, we added a grouping field to several tables and then wanted to copy it from sales order line to stock move. We overrode the sale module's version of sale_order._prepare_order_line_move() with our own version.
I posted a separate question about customizing reports.
The down side is that every customized feature we try to migrate requires some change. So far there has always been a change in the core module that somehow breaks our customization. Either a field name changed, or the screen layout changed, or the whole model name changed. You can usually figure out how to fix it, but everything takes time.
The best approach is to contract an OpenERP Enterprise. Migrating is quite complex and OpenERP can do the job for you. It's a fixed price for unlimited bugfixes and migrations: http://www.openerp.com/catalog/146

MVC 3 & ASP.Net with Entity Framework scaffolding error : No model classes are available

I am trying to use MVC3 with the Entity framework with Code First, but the code Template generation process in MS Visual Web Developer 2010 - is not detecting my Model in the models folder - giving a message - "No Model classes are available" - although I do have model classes for which I want to create controllers.
The templating option I've selected is "Controller with read/write actions and views using the Entity Framework".
I've uninstalled and reinstalled Web Developer 2010, but still having the same error.
Anyone know how I can get around this error?
xixonia's response worked for me. All I needed to do was build/rebuild the project and then everything worked as expected.
Rebuild all did not fix this issue for me... until I closed Studio, reopened and rebuilt all. Then it worked like a charm.
After create models must be build your project.
http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-entity-framework-scaffolding-and-migrations
I had this same issue and for me I had to go to the properties of the entity model in the entity model designer and change Code Generation Strategy to Default. It had been set to None because I had experimented with a DbContext generator.
I had this same issue.
While digging through my references, just before throwing the computer against the wall, I found that I had EntityFramework version 4.1 installed in the web project (by VS 2010 when the MVC 3 project was created).
I had 4.3.1 installed in the domain project (from nuget).
I uninstalled both of them and reinstalled from nuget.
Now everything is working again.
Hope this helps.
If you still have this problem then follow these steps to fix the problem:
1. Right click on your project and select [Manage NuGet Packages]
2. On the opened popup window, on the left hand pane, select Updates
3. On the right hand pane, at the very top right click on the Update All
During this process, it will ask you whether you want to overwrite the existing references (not sure about the exact phrase). So, say "Yes" to overwrite...
Now try to add the controller to your project and everything will be fine.
Good Luck!