Postgres function and Entity Framework - entity-framework

Does anyone have any idea how to import a Postgres function into an ASP.NET MVC model using NPGSQL?
I tried but I get "value out of range" error as the result of executing stored procedure, I tried different version of npgsql and Entity Framework but still no success, any comment?

Related

Method 'NpgsqlCommand.set_ExpectedTypes' not found

Hi I am getting below error - method not found void Npgsql.NpgsqlCommand set
Error Image for reference
I am using Entity framework 6 and Npgsql.EntityFramework version 2.2.7.0 and Npgsql 2.2.7.0.This happens when i am trying to create a ADO.NET Data Entity Model and generate code first from database. Thanks in advance.

EF Context missing a collection

I'm trying to generate an entity from my SQL database using the ADO.NET Entity Data Model using the ADO.NET DbContext Generator. When I generate my edmx from the database I can see it in the model. I right click on my tt file (which is in a separate project) and run the custom tool. The entity appears. It's called CustomerContact. However, my dbcontext does not have a CustomerContacts collection. What is going on here?
I figured it out. The problem was the different versions of Entity Framework. I updated both projects to the latest version of EF and it works now

'Database' is an ambiguous reference between 'System.Data.Entity.Database'

I have database-first MVC application. The database is postgres with dotconnect data provider. The project works fine without a problem. However when I choose another database in same server, I'm having following error from in InitializeSimpleMembershipAttribute.cs class.
'Database' is an ambiguous reference between 'System.Data.Entity.Database' and 'applicationName.Models.Database'
The only deference I can track is the new database is generated from the program called 'dbwrench'. Can anyone explain me what this error is meaning about?

Can't generate EF model correctly with Devart dotConnect for PostgreSQL product

I have problem when creating Entity Framework model from an existing PostgreSQL database with the Devart dotConnect for PostgreSQL product.
This product offer 2 ways of generating EF model from a database and neither seems to work.
When using an ADO.Net Entity data Model with this Devart provider, the tables list appear empty in the wizard when generating model from database.
When using the Devart Entity Model, the table list appear correctly in the wizard and model is generated but all navigations properties are missing and all not nullable fields are generated as entity keys.
Anyone has experience with this product and can confirm me if I'm facing bugs or if I'm not using it correctly?
Thanks
Etienne
After some investigation it seems that the database user in PostgreSQL I was using to access dabatase from Entity Framework was missing the INHERIT attribute. Without this attribute the user was not inheriting from his group privileges that give him access to database objects...
The behavior differences between the 2 ways of generating EF model is due to the fact that obtaining the metadata in ADO.NET Entity Data Model Wizard is implemented mainly through the 'information_schema', while in Entity Developer it is implemented with 'pg_catalog'.

Calling stored procedure from Entity Framework - ASP.NET MVC 2

In my ASP.NET MVC 2 project I'm trying to call a stored procedure from EF, the problem is after I followed the directions here (went this route because there's nothing in the model that maps to this stored procedure so I added 2 entities for the 2 stored procedures) I get this error:
GCTModel.msl(3,4) : error 3027: No
mapping specified for the following
EntitySet/AssociationSet -
GalleryAnimalLists, GalleryImages.
Now, since I had to add manual entities to map these SP's to how do I get rid of this error message? And ideas on what I'm doing wrong here, or is this post on his blog just wrong for MVC 2?
I ended up deleting the hand rolled entities I created for the function imports and created 2 complex types and mapped the function imports to those and it works perfectly. Just thought I'd share the solution I came up with in case someone came along with a similar issue