LinqConnect Documentation
In This Topic
    Customizing Conventions List
    In This Topic

    The Conventions property of the FluentMappingBuilder class stores the collection of all the default conventions. You may add user conventions that implement one or more specific interfaces to this collection. You also may disable default conventions or change their behaviour if the conventions support additional settings. For example, let's delete PrimaryKeyConvention - the convention that specifies the primary key for entities without the explicitly specified primary key:

    builder.Conventions.Remove<PrimaryKeyConvention>();

    Lets change the behaviour of the StringPropertyConvention to set MaxLength to 100 for all the string properties for which this parameter was not explicitly specified.

    builder.Conventions.OfType<StringPropertyConvention>().Single().MaxLength = 100;

    Here is the example of adding new user convention:

    builder.Conventions.Add(new UserDefinedConvention());