-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
MSugiura edited this page Dec 27, 2023
·
1 revision
Before using RedOrb, you need to configure the environment.
Please set the environment only once within the application.
Set the symbols used in parameter queries (such as "@" for SQLServer and ":" for Postgresql) to ObjectRelationMapper.
//Postgres sample
ObjectRelationMapper.PlaceholderIdentifer = ":";
You need to define your model class using attributes. Please refer to the Model page for how to define it.
Register the Model class using the ObjectRelationMapper.AddTypeHandler method.
ObjectRelationMapper.AddTypeHandler(DefinitionBuilder.Create<Blog>());
Example of initial settings when using xUnit.
using RedOrb;
internal static class UnitTestInitializer
{
[ModuleInitializer]
public static void Initialize()
{
ObjectRelationMapper.PlaceholderIdentifer = ":";
ObjectRelationMapper.AddTypeHandler(DefinitionBuilder.Create<Blog>());
ObjectRelationMapper.AddTypeHandler(DefinitionBuilder.Create<Post>());
}
}