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!
Exception on Updating Entity Framework Model with Functions
Re: Exception on Updating Entity Framework Model with Functions
Test function:
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?
Code: Select all
CREATE OR REPLACE FUNCTION test()
RETURNS integer AS
$BODY$
select 1;
$BODY$
LANGUAGE sql IMMUTABLE STRICT
COST 100;
Re: Exception on Updating Entity Framework Model with Functions
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!
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!
Re: Exception on Updating Entity Framework Model with Functions
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.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.
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.
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:concware wrote:Can you show, that how to add a function that returns a set of table results?
Code: Select all
CREATE TABLE DEPT (
DEPTNO INT PRIMARY KEY,
DNAME VARCHAR(14),
LOC VARCHAR(13)
);
Re: Exception on Updating Entity Framework Model with Functions
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:
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.
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:
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.
Re: Exception on Updating Entity Framework Model with Functions
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 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 disable the DbContext template in your model. Add the predefined EntityObject template instead. Try your approach again.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.
DbContext is a wrapper around ObjectContext, it’s a simplified (without some functionality like QueryProvider property) version of ObjectContext.
If the information above doesn't help, specify what exactly functionality a test project should cover:concware wrote:Please help me with a sample project or anything that can helps me.
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