Using edmfunction with Visual Studio plugin

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
jonathanp
Posts: 6
Joined: Tue 30 Jul 2013 08:50

Using edmfunction with Visual Studio plugin

Post by jonathanp » Tue 30 Jul 2013 08:59

Hi,

I have added an edmfunction to the conceptual model in the .edml file, however whenever the entities are re-generated using the designer in the Visual Studio plugin my edmfunction is deleted. Is there a way to add the edmfunction through the designer or some other way to indicate to the designer that this function should not be deleted?

Thanks

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

Re: Using edmfunction with Visual Studio plugin

Post by Shalex » Mon 05 Aug 2013 14:40

Thank you for your report. We will notify you when the bug with a serialization of edmfunctions in CSDL is fixed.

jonathanp
Posts: 6
Joined: Tue 30 Jul 2013 08:50

Re: Using edmfunction with Visual Studio plugin

Post by jonathanp » Tue 06 Aug 2013 08:10

Thanks Shalex

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

Re: Using edmfunction with Visual Studio plugin

Post by Shalex » Mon 12 Aug 2013 10:00

The design time support for model-defined functions is added. We will post here when the corresponding build of Entity Developer is available for download.

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

Re: Using edmfunction with Visual Studio plugin

Post by Shalex » Thu 05 Sep 2013 16:37

New build of Entity Developer 5.5.185 is available for download now!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=32&t=27871.

jonathanp
Posts: 6
Joined: Tue 30 Jul 2013 08:50

Re: Using edmfunction with Visual Studio plugin

Post by jonathanp » Wed 18 Sep 2013 08:53

Hi Shalex,

I just tested the latest build which you posted, however it seems that it is not possible to use an entity for an input parameter (although it seems possible to use an entity for a return type).

If this is the case then it is worse than before - previously I had the annoyance of having to manually copy the XML for the function into the CSDL every time I regenerated the entities, now I am completely unable to use the function as an error is generated which stops the model from being parsed:

"
CSDL parsing failed: The attribute 'Type' or tag 'Parameter' has a unexpected value 'EntityName' at line #6950. Warning! The error means that a part of the model cannot be read. If you save the model after this, the unrecognized XML will be lost. It is strongly recommended to create a backup copy of the model to be able to restore it to the original state if needed.
"

Please tell me there is a way around this, otherwise I will have to roll back to the previous version of the Entity Developer.

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

Re: Using edmfunction with Visual Studio plugin

Post by Shalex » Fri 20 Sep 2013 12:06

The "Model-Defined Functions in Entity Developer" article is available at http://blogs.devart.com/dotconnect/mode ... loper.html.
jonathanp wrote:it seems that it is not possible to use an entity for an input parameter
We will investigate the possibility of supporting this feature and notify you about the result.
jonathanp wrote:previously I had the annoyance of having to manually copy the XML for the function into the CSDL every time I regenerated the entities, now I am completely unable to use the function as an error is generated which stops the model from being parsed
Please post here or send us the XML snippet (or a test model) which fails to be parsed with Entity Developer.

jonathanp
Posts: 6
Joined: Tue 30 Jul 2013 08:50

Re: Using edmfunction with Visual Studio plugin

Post by jonathanp » Fri 20 Sep 2013 12:43

A snippet from my model:

Code: Select all

<Function Name="FullName" ReturnType="Edm.String">
    <Parameter Name="person" Type="MyNamespace.Person"></Parameter>
    <DefiningExpression>
        person.FirstName + " " + person.SecondName
    </DefiningExpression>
</Function>
I am using the result of this function in LINQ projections using the following extension method:

Code: Select all

[EdmFunction("MyNamespace", "FullName")]
public static string GetFullName(this Person person)
{
    throw new NotSupportedException("Direct calls are not supported");
}

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

Re: Using edmfunction with Visual Studio plugin

Post by Shalex » Wed 25 Sep 2013 09:42

jonathanp wrote:

Code: Select all

<Function Name="FullName" ReturnType="Edm.String">
    <Parameter Name="person" Type="MyNamespace.Person"></Parameter>
    <DefiningExpression>
        person.FirstName + " " + person.SecondName
    </DefiningExpression>
</Function>
Entity Developer supports only scalar parameters for model-defined functions at the moment. We will investigate the possibility of using entity for an input parameter and notify you about the result as soon as possible.

jonathanp
Posts: 6
Joined: Tue 30 Jul 2013 08:50

Re: Using edmfunction with Visual Studio plugin

Post by jonathanp » Wed 25 Sep 2013 10:26

Ok, thanks Shalex.

jonathanp
Posts: 6
Joined: Tue 30 Jul 2013 08:50

Re: Using edmfunction with Visual Studio plugin

Post by jonathanp » Fri 15 Nov 2013 09:54

Hi Shalex,

Do you have any update on if a fix will be provided for this? If not then I will have to roll back to the previous version of Entity Developer.

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

Re: Using edmfunction with Visual Studio plugin

Post by Shalex » Tue 19 Nov 2013 12:57

jonathanp wrote:Do you have any update on if a fix will be provided for this?
Currently there is no timeframe for implementing support for using entity as an input parameter of model-defined functions. Please post your suggestion at http://devart.uservoice.com/forums/3867 ... -developer.
jonathanp wrote:If not then I will have to roll back to the previous version of Entity Developer.
This will not help. Although the previous version does not throw the error, it ignores the XML which sets entity as an input parameter of a model-defined function.

Post Reply