diff --git a/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Attributes/OrderSagaDataAttributes.cs b/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Attributes/OrderSagaDataAttributes.cs index 169c662ddb8..4fcdee9d938 100644 --- a/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Attributes/OrderSagaDataAttributes.cs +++ b/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Attributes/OrderSagaDataAttributes.cs @@ -3,6 +3,7 @@ using NServiceBus; #pragma warning disable NSB0012 // Saga data classes should inherit ContainSagaData +#region AttributesMapping [Class] public class OrderSagaDataAttributes : @@ -45,4 +46,5 @@ public class AmountInfo } } -#pragma warning restore NSB0012 // Saga data classes should inherit ContainSagaData \ No newline at end of file +#endregion +#pragma warning restore NSB0012 // Saga data classes should inherit ContainSagaData diff --git a/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Fluent/OrderSagaDataFluentMap.cs b/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Fluent/OrderSagaDataFluentMap.cs index 3388421f8c4..6b4029eb879 100644 --- a/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Fluent/OrderSagaDataFluentMap.cs +++ b/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Fluent/OrderSagaDataFluentMap.cs @@ -1,5 +1,7 @@ using FluentNHibernate.Mapping; +#region FluentMapping + public class OrderSagaDataFluentMap : ClassMap { @@ -26,4 +28,6 @@ public OrderSagaDataFluentMap() c.Map(x => x.Currency).Length(3).CustomType("AnsiString"); }); } -} \ No newline at end of file +} + +#endregion diff --git a/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs b/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs index 8caf329806d..bc2cd317594 100644 --- a/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs +++ b/samples/nhibernate/custom-mappings/NHibernate_10/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs @@ -2,6 +2,8 @@ using NHibernate.Mapping.ByCode; using NHibernate.Mapping.ByCode.Conformist; +#region LoquaciousMapping + public class OrderSagaDataLoquaciousMap : ClassMapping { @@ -40,6 +42,8 @@ public OrderSagaDataLoquaciousMap() } } +#endregion + public class OrderSagaDataLoquaciousLocationMap : ClassMapping { diff --git a/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Attributes/OrderSagaDataAttributes.cs b/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Attributes/OrderSagaDataAttributes.cs index 169c662ddb8..4fcdee9d938 100644 --- a/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Attributes/OrderSagaDataAttributes.cs +++ b/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Attributes/OrderSagaDataAttributes.cs @@ -3,6 +3,7 @@ using NServiceBus; #pragma warning disable NSB0012 // Saga data classes should inherit ContainSagaData +#region AttributesMapping [Class] public class OrderSagaDataAttributes : @@ -45,4 +46,5 @@ public class AmountInfo } } -#pragma warning restore NSB0012 // Saga data classes should inherit ContainSagaData \ No newline at end of file +#endregion +#pragma warning restore NSB0012 // Saga data classes should inherit ContainSagaData diff --git a/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Fluent/OrderSagaDataFluentMap.cs b/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Fluent/OrderSagaDataFluentMap.cs index 3388421f8c4..6b4029eb879 100644 --- a/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Fluent/OrderSagaDataFluentMap.cs +++ b/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Fluent/OrderSagaDataFluentMap.cs @@ -1,5 +1,7 @@ using FluentNHibernate.Mapping; +#region FluentMapping + public class OrderSagaDataFluentMap : ClassMap { @@ -26,4 +28,6 @@ public OrderSagaDataFluentMap() c.Map(x => x.Currency).Length(3).CustomType("AnsiString"); }); } -} \ No newline at end of file +} + +#endregion diff --git a/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs b/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs index 8caf329806d..bc2cd317594 100644 --- a/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs +++ b/samples/nhibernate/custom-mappings/NHibernate_9/Sample.Loquacious/OrderSagaDataLoquaciousMap.cs @@ -2,6 +2,8 @@ using NHibernate.Mapping.ByCode; using NHibernate.Mapping.ByCode.Conformist; +#region LoquaciousMapping + public class OrderSagaDataLoquaciousMap : ClassMapping { @@ -40,6 +42,8 @@ public OrderSagaDataLoquaciousMap() } } +#endregion + public class OrderSagaDataLoquaciousLocationMap : ClassMapping { diff --git a/samples/nhibernate/custom-mappings/sample.md b/samples/nhibernate/custom-mappings/sample.md index 9e620d54871..bb77861ebd8 100644 --- a/samples/nhibernate/custom-mappings/sample.md +++ b/samples/nhibernate/custom-mappings/sample.md @@ -36,13 +36,13 @@ Using NHibernate mapping files is the native way to customize the mappings. The For more information, see: [how to create a simple NHibernate based application](https://nhibernate.info/doc/tutorials/first-nh-app/your-first-nhibernate-based-application.html). -### The Mapping +### Mapping The `.hbm.xml` contents is as follows snippet: hmlxml -### Reading the mapping file +### Configuration Create a custom NHibernate configuration object and use the following example to add mappings from the file system. @@ -60,6 +60,12 @@ To use it with NServiceBus: * or by creating a new Configuration instance and pass it to FluentNHibernate 1. Pass it to the NServiceBus NHibernate configuration. +### Mapping + +snippet: FluentMapping + +### Configuration + Example of a possible implementation: snippet: FluentConfiguration @@ -75,6 +81,12 @@ NHibernate.Mapping.Attributes needs to know what types to scan to generate an NH 1. Initialize the attribute mapping (see sample below). 1. Pass it to the NServiceBus NHibernate configuration. +### Mapping + +snippet: AttributesMapping + +### Configuration + Initialize the NHibernate attribute based mappings: snippet: AttributesConfiguration @@ -89,6 +101,12 @@ To use it: 1. Use either the model mapping or convention mapping features. 1. Pass it to the NServiceBus NHibernate configuration. +### Mapping + +snippet: LoquaciousMapping + +### Configuration + Initialize NHibernate Loquacious configuration: snippet: LoquaciousConfiguration