我有问题,节省当我使用GUID作为标识符。 有谁能够瑟什么,我在这里失踪? 创建我自己的GUID,所以我不希望它通过数据库生成。
注:我曾试图映射guid.combo没有任何成功。
public class Order
{
public virtual Guid Id { get; set; }
public virtual ICollection<OrderItem> OrderItems { get; set; }
public virtual User User { get; set; }
public virtual DateTime? CreateDate { get; set; }
public virtual DateTime? ShippedDate { get; set; }
public virtual string OrderStatus { get; set; }
public Order()
{
OrderItems = new Collection<OrderItem>();
}
public virtual void AddOrderItems(OrderItem orderItem)
{
orderItem.Order = this;
OrderItems.Add(orderItem);
}
}
OrderMap:
public OrderMap()
{
Id(x => x.Id).ColumnName("Id").GeneratedBy.Guid();
Map(x => x.CreateDate);
Map(x => x.ShippedDate);
Map(x => x.OrderStatus);
References(x => x.User);
HasMany(x => x.OrderItems).Cascade.All().Inverse().LazyLoad();
}