Page 1 of 1

Using edmfunction with Visual Studio plugin

Posted: Tue 30 Jul 2013 08:59
by jonathanp
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

Re: Using edmfunction with Visual Studio plugin

Posted: Mon 05 Aug 2013 14:40
by Shalex
Thank you for your report. We will notify you when the bug with a serialization of edmfunctions in CSDL is fixed.

Re: Using edmfunction with Visual Studio plugin

Posted: Tue 06 Aug 2013 08:10
by jonathanp
Thanks Shalex

Re: Using edmfunction with Visual Studio plugin

Posted: Mon 12 Aug 2013 10:00
by Shalex
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.

Re: Using edmfunction with Visual Studio plugin

Posted: Thu 05 Sep 2013 16:37
by Shalex
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.

Re: Using edmfunction with Visual Studio plugin

Posted: Wed 18 Sep 2013 08:53
by jonathanp
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.

Re: Using edmfunction with Visual Studio plugin

Posted: Fri 20 Sep 2013 12:06
by Shalex
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.

Re: Using edmfunction with Visual Studio plugin

Posted: Fri 20 Sep 2013 12:43
by jonathanp
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");
}

Re: Using edmfunction with Visual Studio plugin

Posted: Wed 25 Sep 2013 09:42
by Shalex
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.

Re: Using edmfunction with Visual Studio plugin

Posted: Wed 25 Sep 2013 10:26
by jonathanp
Ok, thanks Shalex.

Re: Using edmfunction with Visual Studio plugin

Posted: Fri 15 Nov 2013 09:54
by jonathanp
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.

Re: Using edmfunction with Visual Studio plugin

Posted: Tue 19 Nov 2013 12:57
by Shalex
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.