Exception on Updating Entity Framework Model with Functions

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
concware
Posts: 14
Joined: Thu 09 Jan 2014 21:51

Exception on Updating Entity Framework Model with Functions

Post by concware » Thu 25 Dec 2014 18:18

Helo,

I would like to import newly created postgre sql function to Entity Framework model, but I got the following exception in Visual Studio:

An exception of type 'System.NotSupportedException' occurred while attempting to update from the database. The exception message is: 'The specified type is not supported by this selector.'.

This was the first time, I try to import postgre sql function.

The function contains a simple "Select 1" query.

Thanks your assistance in advance!

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Exception on Updating Entity Framework Model with Functions

Post by Shalex » Mon 29 Dec 2014 16:02

Test function:

Code: Select all

CREATE OR REPLACE FUNCTION test()
  RETURNS integer AS
$BODY$
select 1;
$BODY$
  LANGUAGE sql IMMUTABLE STRICT
  COST 100;
Please open your *.edml in Entity Developer (standalone or embedded one), drag&drop the test function from Entity Developer's Database Explorer to the SSDL part of your model in Model Explorer. Then set the Concealed Function to True for your function in Store part in Model Explorer. Drag&drop the test function to Conceptual part. Does it work?

concware
Posts: 14
Joined: Thu 09 Jan 2014 21:51

Re: Exception on Updating Entity Framework Model with Functions

Post by concware » Tue 17 Mar 2015 22:41

I could do other way, when I asked it, but now this problem is came again.

Can you show a tutorial or any documentation for this?

I am using edmx file and i tried to open with Entity Developer and after the modifications, that you suggested, it expects to save the model as edml file.

Can you show, that how to add a function that returns a set of table results?

Thanks in advance!

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Exception on Updating Entity Framework Model with Functions

Post by Shalex » Thu 19 Mar 2015 11:10

concware wrote:I am using edmx file and i tried to open with Entity Developer and after the modifications, that you suggested, it expects to save the model as edml file.
Output can not be *.edmx because Entity Developer uses extra tags and attributes, additional features which are not supported by EDM Designer. This question was discussed at http://forums.devart.com/viewtopic.php?f=32&t=24766.
We recommend you to use Entity Developer (Devart Entity Model, *.edml) instead of EDM Designer (ADO.NET Entity Data Model, *.edmx) because it is adjusted for working with PostgreSQL and has an advanced functionality: http://www.devart.com/entitydeveloper/ed-vs-edm.html.
concware wrote:Can you show, that how to add a function that returns a set of table results?
Please refer to http://www.devart.com/dotconnect/oracle ... rsors.html (it includes both alternative approaches: Devart Entity Developer and Microsoft EDM Wizard). This tutorial is designed for dotConnect for Oracle, but a similar way is used with dotConnect for PostgreSQL as well. The GET_DEPT_PROC procedure works with the DEPT table which should be created in database and added to the model:

Code: Select all

CREATE TABLE DEPT (
  DEPTNO INT PRIMARY KEY,
  DNAME VARCHAR(14),
  LOC VARCHAR(13)
);

concware
Posts: 14
Joined: Thu 09 Jan 2014 21:51

Re: Exception on Updating Entity Framework Model with Functions

Post by concware » Fri 20 Mar 2015 09:27

Your help is so helpful, the only problem is, the oracle tutorial does not work with PostgreSQL.

I created the test function that you posted and imported it to the devart model browser and it is appeared in the Stored Procedures node in the Model Browser. When I try to create the method on the general tab, i cannot select the test method in the drop down, because the dropdown list is empty.

You can see it the following image:
Image

This is the third day, i am trying to add a function to the model without any success.

I also tried to use the following link:
http://blog.devart.com/model-defined-fu ... loper.html

I created method like this, the function is generated in the edml file, but the C# EdmFunction is not generated. I tried to create the function manually, but the queryprovider in the DbContext is unknown property.

Please help me with a sample project or anything that can helps me.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Exception on Updating Entity Framework Model with Functions

Post by Shalex » Fri 20 Mar 2015 18:28

concware wrote:I created the test function that you posted and imported it to the devart model browser and it is appeared in the Stored Procedures node in the Model Browser. When I try to create the method on the general tab, i cannot select the test method in the drop down, because the dropdown list is empty.
Please select the dbo.Test function in the Store part of Model Explorer and set its Concealed Function property to True. Now it should be available in the Storage Procedure dropdown list.
concware wrote:I also tried to use the following link:
http://blog.devart.com/model-defined-fu ... loper.html
I created method like this, the function is generated in the edml file, but the C# EdmFunction is not generated. I tried to create the function manually, but the queryprovider in the DbContext is unknown property.
Please disable the DbContext template in your model. Add the predefined EntityObject template instead. Try your approach again.

DbContext is a wrapper around ObjectContext, it’s a simplified (without some functionality like QueryProvider property) version of ObjectContext.
concware wrote:Please help me with a sample project or anything that can helps me.
If the information above doesn't help, specify what exactly functionality a test project should cover:
1) *.edml or *.edmx
2) which predefined template and its non-default properties you are using
3) database function or model-defined function
4) send us the DDL script of your function and related database objects
5) what actions a test project should perform

Post Reply