Exemplo n.º 1
0
 /// <summary>
 /// Set all Entity Ids to a new Comb Guid.
 /// </summary>
 /// <param name="entities"></param>
 public static void SetEntityIds(params Entity[] entities)
 {
     foreach (var entity in entities)
     {
         typeof(Entity).GetProperty("Id").SetValue(entity, GuidCombGenerator.GenerateComb());
     }
 }
Exemplo n.º 2
0
 public File(string name, string type, byte[] content)
 {
     Id      = GuidCombGenerator.GenerateComb();
     Name    = name;
     Type    = type;
     Content = content;
 }
Exemplo n.º 3
0
 public static void SetEntityId(this DbContext context)
 {
     foreach (var entry in context.ChangeTracker.Entries <Entity>()
              .Where(e => e.State == EntityState.Added))
     {
         typeof(Entity).GetProperty("Id").SetValue(entry.Entity, GuidCombGenerator.GenerateComb());
     }
 }