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

Commented Unassigned: Unique Indices [59]

$
0
0
It seems there is no option to identify unique keys of a table in database in generated configuration mapping classes.
For example


```
CREATE TABLE [dbo].[FinancialInstitutionOffice](
[Code] [uniqueidentifier] NOT NULL,
[FinancialInstitutionCode] [uniqueidentifier] NOT NULL,
[OfficeName] [nvarchar](200) NULL,
...

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [UniqueOfficeName_FinancialInstitutionOffice] UNIQUE NONCLUSTERED
(
[FinancialInstitutionCode] ASC,
[OfficeName] ASC,
)
```

The generated code does not show the constraint of above table.
Comments: I have already added support for unique constraints. In the case above, the OfficeName is NULLable, which is not allowed in entity framework. If I added this as a primary key you would get the following error. ``` OfficeName: Nullable: Key part 'OfficeName' for type 'FinancialInstitutionOffice' is not valid. All parts of the key must be non-nullable. ```

Viewing all articles
Browse latest Browse all 1642

Trending Articles



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