This question is locked. New answers and comments are not allowed.
Hello,
I'm using the Fluent API (with MS SQL) and am attempting to map an entity to a view. The view is already created so when I run the CreateUpdateDDLScript via the schema handler, it attempts to create a table with the name of view. Is there a way to prevent this from happening?
My mapping configuration looks like this:
I thought about adding a custom bit of code to remove the create table SQL from the generated ddl script but that hack wouldn't be a good long term solution.
Thanks,
Thomas
I'm using the Fluent API (with MS SQL) and am attempting to map an entity to a view. The view is already created so when I run the CreateUpdateDDLScript via the schema handler, it attempts to create a table with the name of view. Is there a way to prevent this from happening?
My mapping configuration looks like this:
public
static
MappingConfiguration<Account> CreateConfiguration()
{
var mapping =
new
MappingConfiguration<Account>();
mapping.MapType(x =>
new
{
ActID = x.Id,
ActTypeID = x.AccountType,
SrvTypeID = x.ServiceType,
ActExpDate = x.ExpirationDate,
ActExpTypeID = x.ExpirationTypeId,
ActApprovalState = x.ApprovalState,
ActStatus = x.Status,
ActLastMod = x.LastModified,
x.Name,
x.City,
x.State
}).ToTable(
"v_Accounts"
);
mapping.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Default);
return
mapping;
}
I thought about adding a custom bit of code to remove the create table SQL from the generated ddl script but that hack wouldn't be a good long term solution.
Thanks,
Thomas