Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

Commented Unassigned: Computed columns not yet supported [23]

$
0
0
Hi,

First of all: thanks for creating the Reverse POCO Code First Generator, saves me tons of work!
The code produced by it is clean and very well documented.

While using it I came across a scenario which is not yet supported:
My database contains computed columns: My Contactperson table contains a field FullName which is dynamically composed from the FirstName and LastName. The code generator does not yet recognize this so it creates the following output for the field's configuration:

```
Property(x => x.ContactPersoonVolledigeNaam).HasColumnName("ContactPersoonVolledigeNaam").IsRequired().HasMaxLength(53);
```

Where I would expect it to be:
```
Property(x => x.ContactPersoonVolledigeNaam).HasColumnName("ContactPersoonVolledigeNaam").IsRequired().HasMaxLength(53).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
```

Because of this, EF complains when validating and saving the model.

Best regards,
Jeroen
Comments: I discovered this too. I think a better solution would be to make the following addition to add string columns to the types of columns to look for autogenerated options while still limiting the columns that are investigated. private void SetupConfig() { bool hasDatabaseGeneratedOption = false; switch(PropertyType.ToLower()) { case "long": case "short": case "int": case "double": case "float": case "decimal": case "string": // <--- Add this line since string column types can also be autogenerated hasDatabaseGeneratedOption = true; break; }

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>