Skip to content

Instantly share code, notes, and snippets.

@jasondentler
Created February 22, 2011 21:48
Show Gist options
  • Save jasondentler/839484 to your computer and use it in GitHub Desktop.
Save jasondentler/839484 to your computer and use it in GitHub Desktop.
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; }
}
}
using System;
namespace ISIS
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field,
Inherited=true, AllowMultiple=false)]
public class IdAttribute : Attribute
{
}
}
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