The schema or owner can be specified in the following ways:
IDataHelper db = DataHelper.SessionFactory();
db.Mapper.DefaultSchema = "[MyDatabase].[dbo]."
Example:
[TableMapping("Customers", "dbo.")]
public class Customer3
{
}
IDataHelper db = DataHelper.SessionFactory();
Table table = new Table(typeof(Person));
table.TableName =
"People";table.Schema = "dbo.";
IDataHelper db = DataHelper.SessionFactory();
db.Mapper.ObjectMap.Clear();
db.Mapper.MapTablesFromNamespace(
"Models");db.Mapper.SaveObjectMap(
"mymap.xml");db.Mapper.LoadObjectMap(
"mymap.xml");
<?xml version="1.0"?>
<ArrayOfTable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Table>
<MappingFromDatabase>false</MappingFromDatabase>
<Schema>dbo.</Schema>
<ClassTypeString>KellermanSoftware.NetDataAccessLayerTests.TestClasses.SalesPeople, NET-Data-Access-Layer-Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</ClassTypeString>
<ClassName>SalesPeople</ClassName>
<TableName>SalesPeople</TableName>
<Fields>
<Field>
<ColumnName>Salesman</ColumnName>
<PropertyInfoString>Salesman</PropertyInfoString>
<FieldTypeString>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</FieldTypeString>
<DatabaseType>AnsiString</DatabaseType>
<Unique>false</Unique>
<AllowDbNull>false</AllowDbNull>
<IsPrimaryKey>false</IsPrimaryKey>
<KeyType xsi:nil="true" />
<IsReadOnly>false</IsReadOnly>
<Length xsi:nil="true" />
<IsCompositeKey>true</IsCompositeKey>
<IsMaintenanceField>false</IsMaintenanceField>
</Field>
<Field>
<ColumnName>Region</ColumnName>
<PropertyInfoString>Region</PropertyInfoString>
<FieldTypeString>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</FieldTypeString>
<DatabaseType>AnsiString</DatabaseType>
<Unique>false</Unique>
<AllowDbNull>false</AllowDbNull>
<IsPrimaryKey>false</IsPrimaryKey>
<KeyType xsi:nil="true" />
<IsReadOnly>false</IsReadOnly>
<Length xsi:nil="true" />
<IsCompositeKey>true</IsCompositeKey>
<IsMaintenanceField>false</IsMaintenanceField>
</Field>
</Fields>
<CompositeKeys>
<Field>
<ColumnName>Salesman</ColumnName>
<PropertyInfoString>Salesman</PropertyInfoString>
<FieldTypeString>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</FieldTypeString>
<DatabaseType>AnsiString</DatabaseType>
<Unique>false</Unique>
<AllowDbNull>false</AllowDbNull>
<IsPrimaryKey>false</IsPrimaryKey>
<KeyType xsi:nil="true" />
<IsReadOnly>false</IsReadOnly>
<Length xsi:nil="true" />
<IsCompositeKey>true</IsCompositeKey>
<IsMaintenanceField>false</IsMaintenanceField>
</Field>
<Field>
<ColumnName>Region</ColumnName>
<PropertyInfoString>Region</PropertyInfoString>
<FieldTypeString>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</FieldTypeString>
<DatabaseType>AnsiString</DatabaseType>
<Unique>false</Unique>
<AllowDbNull>false</AllowDbNull>
<IsPrimaryKey>false</IsPrimaryKey>
<KeyType xsi:nil="true" />
<IsReadOnly>false</IsReadOnly>
<Length xsi:nil="true" />
<IsCompositeKey>true</IsCompositeKey>
<IsMaintenanceField>false</IsMaintenanceField>
</Field>
</CompositeKeys>
</Table>
<Table>
<MappingFromDatabase>false</MappingFromDatabase>
<Schema>dbo.</Schema>
<ClassTypeString>KellermanSoftware.NetDataAccessLayerTests.TestClasses.Claim, NET-Data-Access-Layer-Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</ClassTypeString>
<ClassName>Claim</ClassName>
<TableName>Claims</TableName>
<Fields>
<Field>
<ColumnName>ClaimType</ColumnName>
<PropertyInfoString>ClaimType</PropertyInfoString>
<FieldTypeString>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</FieldTypeString>
<DatabaseType>AnsiString</DatabaseType>
<Unique>false</Unique>
<AllowDbNull>false</AllowDbNull>
<IsPrimaryKey>false</IsPrimaryKey>
<KeyType xsi:nil="true" />
<IsReadOnly>false</IsReadOnly>
<Length xsi:nil="true" />
<IsCompositeKey>false</IsCompositeKey>
<IsMaintenanceField>false</IsMaintenanceField>
<CompositionPropertyString>Detail</CompositionPropertyString>
</Field>
</Fields>
<CompositeKeys />
</Table>
</ArrayOfTable>