Method 'NpgsqlCommand.set_ExpectedTypes' not found - postgresql

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.

Related

Cashed code-first model with Npgsql

I'm trying to turn on use of cached entity models (after reading https://mirkomaggioni.com/2018/01/06/performance-improvements-in-entity-framework-6-2/) along with Npgsql provider.
dbconfiguration:
Class NpgsqlConfiguration
Inherits System.Data.Entity.DbConfiguration
Public Sub New()
Dim provider = "Npgsql"
SetProviderServices(provider, Npgsql.NpgsqlServices.Instance)
SetProviderFactory(provider, Npgsql.NpgsqlFactory.Instance)
SetDefaultConnectionFactory(New Npgsql.NpgsqlConnectionFactory())
SetModelStore(New DefaultDbModelStore(Directory.GetCurrentDirectory()))
End Sub
End Class
At the first run Edmx model is generated, with valid content.
However on the second run exception occurs, when i try to get access to some db sets from the context
ctx.Set(Of EntityClass).ToList()
System.ArgumentException: 'The path is not of a legal form.'
How can i overcome this? Thanks for the help.
Entity framework 6.2.0, Ngpsql 4.0.2, ef.npgsql 3.2.0
I'm using Costura.Fody for the solution, and when i've disabled it, EF started to load the generated model.
Hovewer I've didn't notice any significant performance boost :/
calling the first query with no edmx model takes about 2.4s
calling the first query with edmx model takes about 2.2s
I have 46 entities (tables) in the model, may be it is too small amount to find the effect of caching..

Postgres function and 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?

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

Serializing an entity's field using Entity Framework 4

I've recently been working on a portal using MVC2 and I'm trying to use EF4 as the DAL.
I have an entity called WidgetInstance which serializes it's state into json. EF4 correctly identifies this as a string field but I need this to deserialize to a List<WidgetState> when it's loaded and serialize back to a string when saving/updating.
I've googled and SO'd for an hour or so now without much success. I don't really want to create a new DB table for the widget states.
Has anyone attempted to do this before or have any pointers where I can get started with this?
Thanks

EdmRelationshipAttribute error in Entity Framework

I am experiencing the following error when I try to assign a new reference to a navigation property. So far, all of my searching has not really turned up anything useful, so I was wondering if I might get any help from SO on this.
Metadata information for the
relationship
'CustomerModel.FK_Execution_ClientBlock'
could not be retrieved. Make sure that
the EdmRelationshipAttribute for the
relationship has been defined in the
assembly
What is strange is that all of my code works. This is only occurring during a unit test. I assume it's because I'm using a mocking framework (MOQ) to mock up this particular EF object.
We're using the version of EF that comes with .net 3.5 if that helps.
I have previously had a similar problem, in my case the solution was this: MetadataException when using Entity Framework Entity Connection
Basically you need to add the name of the dll to the metadata connection string