Created
February 22, 2011 21:48
-
-
Save jasondentler/839484 to your computer and use it in GitHub Desktop.
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
using System; | |
namespace ISIS | |
{ | |
public class CourseList : IEntity | |
{ | |
[Id] | |
public Guid CourseId { get; set; } | |
public string Rubric { get; set; } | |
public string Number { get; set; } | |
public string Title { get; set; } | |
} | |
} |
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
using System; | |
namespace ISIS | |
{ | |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, | |
Inherited=true, AllowMultiple=false)] | |
public class IdAttribute : Attribute | |
{ | |
} | |
} |
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 HbmMapping GetMapping() | |
{ | |
var orm = new ObjectRelationalMapper(); | |
var mapper = new Mapper(orm, new CoolPatternsAppliersHolder(orm)); | |
orm.Patterns.PoidStrategies.Add(new AssignedPoidPattern()); | |
var domainClasses = typeof (IEntity).Assembly.GetTypes() | |
.Where(t => t.IsClass && !t.IsAbstract) | |
.Where(t => typeof (IEntity).IsAssignableFrom(t)) | |
.ToArray(); | |
orm.TablePerClass(domainClasses); | |
mapper.AddRootClassPattern(t => true, applier => applier.Lazy(false)); | |
var mapping = mapper.CompileMappingFor(domainClasses); | |
return mapping; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment