Jobs module: Create the fluent mappings
Fluent mappings provide a single place where all persistent classes are configured. To create the fluent mappings for the Jobs module, you must do the following:
Define the specific fluent mapping
- In Visual Studio, in your project, open the context menu of the Model folder and click Add » New Item...
- In the left pane, select Visual C# » Code.
- Click Class and in the Name input field, enter JobsFluentMapping.cs
- Open the JobsFluentMapping.cs file.
- Change the class definition.
- Create the constructor.
- Override the GetMapping method.
EXAMPLE: For more information about the contents of the file, refer to class JobsFluentMapping.cs
from the downloaded sample project.
In this class, all mappings inherit OpenAccessFluentMappingBase and override the GetMapping method. You first create a mapping configuration. Then, you specify the name of the table. Finally, you specify the properties in the mapping.
Create the specific metadata source
- In Visual Studio, in your project, open the context menu of the Model folder and click Add » New Item...
- In the left pane, select Visual C# » Code.
- Click Class and in the Name input field, enter JobsFluentMetadataSource.cs
- Open the JobsFluentMetadataSource.cs file.
- Change the class definition to inherit
ContentBaseMetadataSource
.
- Create the constructors.
- Override the BuildCustomMappings method.
EXAMPLE: For more information about the contents of the file, refer to class JobsFluentMetadataSource.cs
from the downloaded sample project.
In this class, you inherit from ContentBaseMetadataSource and reuse the functionality in the method. You must override the BuildCustomMappings method by adding JobsFluentMapping to the mappings created in the base implementation.