Map a Strategy Pattern using Fluent NHibernate -
Basically the title of this question tells me what I'm trying to do, but to create an inappropriate example ...
I have a class, it's called an employee. Employee has an IP address ...
Employees of public squares {iPad payday payment; Protected Internal Employee () {/ * NH / Public Public Required) (iPadBewien Payment Beverage) {_paymentBehavior = paymentBehavior; }} This corresponds to a database table like this:
dbo.Employees
> employee (primary key)
< Br>
PaymentBehaviourId (key to see foreign key)
field 1
field 2
field 3
field 4
/ P>
Depending on the value of PaymentBehaviourId, I need to 'inject' a different implementation of the iptv-Battery for the purpose of the employee
Can anyone tell me how to use Fluent-NHBernet Will be done?
Classes
Public Sector Employees {/ * ... * / Public PaymentBusiness PaymentBavier {Received; Set;}} Public Sector PaymentBehaviourA: IPaymentBehavior {/ * ... * / Public int field1 {get} set;}} public A class PaymentBehaviourB: IPaymentBehavior {/ * ... * / public int field2 {get} set;}} I do not know whether FluentNHibernate is sufficient, it tells you what it looks like , But in XML you will specify it like this:
class name = "employee" table = "employee" & gt; & lt; multiple-to-one name = "PaymentBavic" class = "iPad" /> & Lt; Subclass name = "PaymentBehaviourA" discriminator-value = "A" & gt; & Lt; Property Name = "Field 1" / & gt; & Lt; / Subclass & gt; & Lt; Subclass name = "PaymentBehaviourB" discriminator-value = "B" & gt; & Lt; Property Name = "Field2" /> & Lt; / Subclass & gt; & Lt; / Square & gt;
Comments
Post a Comment