Beispiel #1
0
 public static void GetEntityWithChanges(IGetEntityWithChanges <TEntity> msg)
 {
     using (var ctx = new TDBContext())
     {
         try
         {
             var whereStr = msg.Changes.Aggregate("", (str, itm) => str + ($"{itm.Key} == \"{itm.Value}\" &&"));
             whereStr = whereStr.TrimEnd('&');
             if (string.IsNullOrEmpty(whereStr))
             {
                 return;
             }
             var p = ctx.Set <TDBEntity>().AsNoTracking().Where(whereStr).FirstOrDefault();
             EventMessageBus.Current.Publish(new EntityWithChangesFound <TEntity>((TEntity)(object)p, msg.Changes, new StateEventInfo(msg.Process.Id, RevolutionData.Context.Entity.Events.EntityFound), msg.Process, Source), Source);
         }
         catch (Exception ex)
         {
             PublishProcesError(msg, ex, typeof(IEntityWithChangesFound <TEntity>));
         }
     }
 }
 public static void GetEntity <TEntity>(this IGetEntityWithChanges <TEntity> msg) where TEntity : class, IEntity
 {
     EF7DataContext <TEntity> .GetEntityWithChanges(msg);
 }
Beispiel #3
0
 public static void GetEntityWithChanges(IGetEntityWithChanges <TEntity> msg)
 {
     typeof(EntityRepository <, ,>).MakeGenericType(typeof(TEntity), EntityType, ctxType)
     .GetMethod("GetEntityWithChanges")
     .Invoke(null, new object[] { msg });
 }