Exemple #1
0
        public static void GetEntityViewById(IGetEntityViewById <TView> msg)
        {
            try
            {
                var exp = FindExpressionClass.FindExpression <TDbEntity, TDbView>();
                using (var ctx = new TDbContext())
                {
                    // ReSharper disable once ReplaceWithSingleCallToFirstOrDefault cuz EF7 bugging LEAVE JUST SO
                    var res = ctx.Set <TDbEntity>().AsNoTracking().Select(exp).FirstOrDefault(x => x.Id == msg.EntityId);//

                    EventMessageBus.Current.Publish(new EntityFound <TView>((TView)(object)res, new StateEventInfo(msg.Process.Id, EntityView.Events.EntityViewFound), msg.Process, Source), Source);
                }
            }
            catch (Exception ex)
            {
                PublishProcesError(msg, ex, typeof(IEntityFound <TView>));
            }
        }
Exemple #2
0
 public static void GetEntityViewById(IGetEntityViewById <TEntityView> msg)
 {
     typeof(EntityViewRepository <, , , ,>).MakeGenericType(typeof(TEntityView), ViewType, TEntity, EntityType, ctxType)
     .GetMethod("GetEntityViewById")
     .Invoke(null, new object[] { msg });
 }
 public static void GetEntity <TEntityView>(this IGetEntityViewById <TEntityView> msg) where TEntityView : IEntityView
 {
     EntityViewDataContext <TEntityView> .GetEntityViewById(msg);
 }