This question is locked. New answers and comments are not allowed.
Hi,
I've been testing OpenAccess Fluent mapping, and must say i've got everything I want (auto inc pk, fk, vertical mapping)
Except I cannot find how to set the Table Schema.
As you can see I map the table to "Application.Data.Contacts", while the class is called Contact. If I now let OA create the database objects, I'm getting a table "Contacts", but not in the schema "Application.Data". I did create the schema in the db. When I look at what OA creates when making a model via the wizard, it does this. Strangely enough this Contact works fine, and the prefix for the name, the schema, is ignored..
So, how can I set the schema name correct via fluent mapping?
Thanks,
Erik
I've been testing OpenAccess Fluent mapping, and must say i've got everything I want (auto inc pk, fk, vertical mapping)
Except I cannot find how to set the Table Schema.
Dim
contactConfiguration
As
New
MappingConfiguration(Of Contact)()
contactConfiguration.MapType(
Function
(p)
New
With
{p}).WithConcurencyControl(OptimisticConcurrencyControlStrategy.Changed).ToTable(
"Application.Data.Contacts"
)
contactConfiguration.HasProperty(
Function
(f) f.ContactId).IsIdentity(KeyGenerator.Autoinc).HasFieldName(
"l_ContactId"
).WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn(
"ContactId"
).IsNotNullable().HasColumnType(
"bigint"
).HasPrecision(0).HasScale(0)
contactConfiguration.HasProperty(
Function
(f) f.Name).HasFieldName(
"l_Name"
).WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn(
"Name"
).IsNullable().HasColumnType(
"nvarchar"
).HasLength(150)
contactConfiguration.HasProperty(
Function
(f) f.TypeCode).HasFieldName(
"l_TypeCode"
).WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn(
"TypeCode"
).IsNullable().HasColumnType(
"nvarchar"
).HasLength(50)
contactConfiguration.FieldNamingRules.AddPrefix =
"l_"
As you can see I map the table to "Application.Data.Contacts", while the class is called Contact. If I now let OA create the database objects, I'm getting a table "Contacts", but not in the schema "Application.Data". I did create the schema in the db. When I look at what OA creates when making a model via the wizard, it does this. Strangely enough this Contact works fine, and the prefix for the name, the schema, is ignored..
So, how can I set the schema name correct via fluent mapping?
Thanks,
Erik