Creating a Property

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
adrianneagoe
Posts: 3
Joined: Mon 06 Sep 2021 08:36

Creating a Property

Post by adrianneagoe » Mon 06 Sep 2021 09:18

Hello all,
In online documentation for Entity Developer, property editor have combo Store Generated: (see link: https://www.devart.com/entitydeveloper/ ... g-efc.html

But in reality this window is like that:https://www.devart.com/entitydeveloper/ ... 1599164336

This window is dependent on the ORM model, I use Entity Framework Core in the given example ?

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

Re: Creating a Property

Post by Shalex » Mon 06 Sep 2021 10:15

Two links in your post open the same page of Entity Developer documentation.

There are two editors in EF Core Model:
* Property Editor - you can open it via class property's context menu
* Column Editor - you should press [...] against column name in Property Editor to open the corresponding Column Editor

Does this information help?

adrianneagoe
Posts: 3
Joined: Mon 06 Sep 2021 08:36

Re: Creating a Property

Post by adrianneagoe » Mon 06 Sep 2021 11:17

In your documentation we found the text below and a picture with a window that looks different than the property window in the entity developer:

Search for this:

Store Generated - determines if the column needs a value during insert and update operations, or it is autogenerated. Can accept the following values:

None - It is not a server generated property. This is the default value.

Identity - a value is generated on insert and remains unchanged on update.

Computed - avalue is generated on both insert and update.

I need a computed property to concatenate 2 string from another 2 property.

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

Re: Creating a Property

Post by Shalex » Mon 06 Sep 2021 18:03

Devart Entity Model (*.edml) -> Property Editor includes Store Generated: None / Identity / Computed.

Devart EF Core Model (*.efml) -> Property Editor includes Value Generated: Never / OnAdd / OnAddOrUpdate.

If you are working with the *.efml model, use the Value Generated option.

adrianneagoe
Posts: 3
Joined: Mon 06 Sep 2021 08:36

Re: Creating a Property

Post by adrianneagoe » Tue 07 Sep 2021 05:40

After buying the Entity Developer license, in the online help I did not find how to set or configure the application to generate a simple property such as, I mention that I use Entity Framework Core 5.09:

[NotMapped]
public virtual string FullName => $ "{FirstName} {LastName}";


If I define it manually in the file generated by Entity Developer it works.
Attribute input works, but how does the concatenation expression apply?

Solution 1 (but this is not crystal clear :)))

public partial class PersoaneContact
{
[NotMapped]
public virtual string NumeComplet => $"{Nume} {Prenume}";
}

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

Re: Creating a Property

Post by Shalex » Tue 07 Sep 2021 10:56

With the current implementation, please set Generate Partial Class=True in the properties of EF Core template and create NotMapped properties manually in MyClass.cs (MyClass.Generated.cs will be regenerated each time you save the model).

JIC: remove the previously generated *.cs files after setting Generate Partial Class=True

Post Reply