Frequently used APIs
Frequently used customizations
Below are some of the frequently used customizations using fluent API
Index
You can specify an index over a column as follows:
Index uniqueness
By default, indexes aren't unique: multiple rows are allowed to have the same value(s) for the index's column set. You can make an index unique as follows:
Attempting to insert more than one entity with the same values for the index's column set will cause an exception to be thrown.
Column names
If you prefer to configure your columns with different names, you can do so as following code snippet:
Column data types
You can also configure your columns to specify an exact data type for a column. For example, the following code configures Url
as a non-unicode string with maximum length of 200
and Rating
as decimal with precision of 5
and scale of 2
:
Precision and Scale
Entity Framework does not do any validation of precision or scale before passing data to the provider. It is up to the provider or data store to validate as appropriate
Keys
You can configure a single property to be the primary key of an entity as follows:
Detailed reading
Last updated