Configuration - HomeroThompson/firehawk GitHub Wiki
Firehawk configuration consists of three main sections
- Entities
- Mappings
- Naming Conventions
Entities configuration section allows you to indicate what the base entities are and set the list of assemblies that containt the domain entities.
As you may know, MCC needs to know the type of the base entities in order to determine if a given class is an entity or not. You can set more than one base entity:
Firehawk.Init()
.Configure()
.ConfigureEntities()
.AddBaseEntity<MyBaseEntityA>()
.AddBaseEntity<MyBaseEntityB>()
.EndConfig()
.EndConfiguration()
.Initialize(NHConfig);
As mentioned below, Firehawk lets you indicate the set of assemblies that contain the entity types. When Firehawk is creating the full set of entities it will search on the application base directory for the assemblies that contain the entities. You can use filter expressions to include or exclude assemblies based on some condition or just provide a given assembly instance.
Firehawk.Init()
.Configure()
.ConfigureEntities()
.SearchForEntitiesOnThisAssembly(Assembly.GetExecutingAssembly())
.SearchForEntitiesOnTheseAssemblies(a => a.FullName.StartsWith("MyProject.Domain"))
.EndConfig()
.EndConfiguration()
.Initialize(NHConfig);
Additionally you can provide a list with entities by using the {{AddEntities}} method. This method can also be used in combination with the previous ones.
var myEntityList = new List<Type>() { typeof(Customer), typeof(product) };
Firehawk.Init()
.Configure()
.ConfigureEntities()
.SearchForEntitiesOnThisAssembly(Assembly.GetExecutingAssembly())
.AddEntities(myEntityList)
.EndConfig()
.EndConfiguration()
.Initialize(NHConfig);
In this section you define the list of assemblies that contain the mapping classes. This section works similar to the entities section. You can use filter expressions to include or exclude assemblies based on some condition or just provide a given assembly instance.
Firehawk.Init()
.Configure()
.ConfigureMappings()
.SearchForMappingsOnThisAssembly(Assembly.GetExecutingAssembly())
.SearchForMappingsOnTheseAssemblies(a => a.FullName.StartsWith("MyProject.Database"))
.EndConfig()
.EndConfiguration()
.Initialize(NHConfig);
This section allows you to choose the set of naming conventions applied to the different database objects.
Firehawk.Init()
.Configure()
.ConfigureNamingConventions()
.UseConventionForColumnNames(ColumnsNamingConvention.PascalCase)
.EndConfig()
.EndConfiguration()
.BuildMappings(NHConfig);
You can get more detail about the full set of naming conventions on the [Documentation] Naming Conventions section.