This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static ModelMapper GetMappings() | |
| { | |
| var mapper = new ModelMapper(); | |
| mapper.Class<YourClass>(yc => | |
| { | |
| // your configurations here, for example: | |
| yc.Id(x => x.YourClassID, map => | |
| { | |
| map.Column("YourClassID"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapper.Class<Person>(c => | |
| { | |
| c.Id(x => x.PersonID, map => | |
| { | |
| map.Column("PersonID"); | |
| map.Generator(Generators.Identity); | |
| }); | |
| c.Property(x => x.Name); | |
| c.Property(x => x.Address); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ca.List(x => x.Children, map => | |
| { | |
| map.Key(k => k.Column("Parent")); | |
| map.Index(i => i.Column("Position")); | |
| map.Cascade(Cascade.All); | |
| }, | |
| e => e.OneToMany()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static ISessionFactory CreateSessionFactory() | |
| { | |
| string connectionString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; | |
| var configure = new Configuration(); | |
| configure.CurrentSessionContext<CallSessionContext>(); | |
| configure.DataBaseIntegration(x => | |
| { | |
| x.Dialect<MsSql2008Dialect>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Helpers | |
| { | |
| public static string PopulationGroup(int population) | |
| { | |
| if(population < 100) | |
| return "Small"; | |
| else if(population >= 100 && population < 500) | |
| return "Medium"; | |
| else | |
| return "Large"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string PopulationGroup(this City city) | |
| { | |
| if(city.population < 100) | |
| return "Small"; | |
| else if(city.population >= 100 && city.population < 500) | |
| return "Medium"; | |
| else | |
| return "Large"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public partial class City | |
| { | |
| public string PopulationGroup() | |
| { | |
| if(this.population < 100) | |
| return "Small"; | |
| else if(this.population >= 100 && this.population < 500) | |
| return "Medium"; | |
| else | |
| return "Large"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class City : MyProject.Models.City | |
| { | |
| public string PopulationGroup() | |
| { | |
| if(this.population < 100) | |
| return "Small"; | |
| else if(this.population >= 100 && this.population < 500) | |
| return "Medium"; | |
| else | |
| return "Large"; |