2024-05-05 22:08:27 +02:00
|
|
|
|
using FluentNHibernate.Mapping;
|
|
|
|
|
|
|
|
|
|
namespace FirmTracker_Server.nHibernate.Transactions
|
|
|
|
|
{
|
2024-05-06 21:25:10 +02:00
|
|
|
|
public class TransactionMapping : ClassMap<Transaction>
|
2024-05-05 22:08:27 +02:00
|
|
|
|
{
|
|
|
|
|
public TransactionMapping()
|
|
|
|
|
{
|
|
|
|
|
Table("Transactions");
|
2024-05-06 21:25:10 +02:00
|
|
|
|
Id(x => x.Id).GeneratedBy.Identity();
|
2024-05-05 22:08:27 +02:00
|
|
|
|
Map(x => x.Date);
|
|
|
|
|
Map(x => x.EmployeeId);
|
|
|
|
|
Map(x => x.PaymentType);
|
|
|
|
|
Map(x => x.Discount);
|
|
|
|
|
Map(x => x.Description);
|
|
|
|
|
|
2024-05-06 21:25:10 +02:00
|
|
|
|
HasMany(x => x.TransactionProducts)
|
|
|
|
|
.KeyColumn("TransactionId")
|
|
|
|
|
.Cascade.AllDeleteOrphan()
|
|
|
|
|
.Inverse(); // Ustawienie Inverse() wskazuje, że to `TransactionProduct` jest właścicielem relacji
|
2024-06-08 00:24:12 +02:00
|
|
|
|
|
2024-05-05 22:08:27 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|