Nothing happens when updating an entity using the SaveOrUpdate method with FluentNHibernate. Flush does work but I want to use SaveOrUpdate due to existing repository infrastructure. What could be the problem?
Configuration:
sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2005
.ConnectionString(c => c.FromConnectionStringWithKey("repository")))
.Mappings(m => m.FluentMappings
.AddFromAssemblyOf<InvoiceMap>())
.BuildSessionFactory();
Mappings:
public InvoiceMap()
{
Id(x => x.InvoiceID, "InvoiceID");
Map(x => x.InvoiceNumber);
Map(x => x.InvoiceDate);
Map(x => x.Company).CustomTypeIs<CompanyType>();
Map(x => x.TransactionNumber).CustomTypeIs<TransactionNumberType>();
Map(x => x.LongAddressBookNumber);
Map(x => x.PurchaseOrderNumber);
Map(x => x.ReceivedDateTime);
Map(x => x.OCR);
Map(x => x.DocumentNumber);
Map(x => x.DocumentType);
Map(x => x.PaymentStatus).CustomTypeIs<PaymentStatusType>();
HasMany(x => x.Attestations)
.KeyColumnNames.Add("InvoiceID")
.Inverse()
.Cascade.AllDeleteOrphan()
.AsBag();
HasMany(x => x.AttestationRequests)
.KeyColumnNames.Add("InvoiceID")
.Inverse()
.Cascade.AllDeleteOrphan()
.AsBag();
HasMany(x => x.States)
.KeyColumnNames.Add("InvoiceID")
.Inverse()
.Cascade.AllDeleteOrphan()
.AsBag();
}
public AttestationMap()
{
Id(x => x.ID, "AttestationID");
Map(x => x.ReceivedAt);
Map(x => x.IsInvalid, "Invalid");
Map(x => x.InvalidationReason);
Map(x => x.FileName);
Map(x => x.FileData);
References<EmployeeSnapshot>(x => x.Certifier, "Certifier")
.Cascade.All()
.FetchType.Join();
References<Invoice>(x => x.Owner, "InvoiceID");
}
public AttestationReminderMap()
{
Id(x => x.ID, "AttestationReminderID");
Map(x => x.CC)
.CustomTypeIs<RecipientType>();
Map(x => x.Message);
Map(x => x.SentAt);
References<AttestationRequest>(x => x.Owner, "RequestID");
}
Any ideas?
Thanks, Kristoffer