Пример #1
0
 private void Service_ModelUpdateEventHandler(T model)
 {
     if (ModelUpdateEventHandler != null)
     {
         ModelCacheEventArgs e = GetEventArgs(model);
         ModelUpdateEventHandler(model, e);
     }
 }
Пример #2
0
        public virtual ModelCacheEventArgs GetEventArgs(T model)
        {
            var prop = model.GetType().GetProperty("id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
            int id   = prop == null ? 0 : (int)prop.GetValue(model);
            ModelCacheEventArgs e = new ModelCacheEventArgs()
            {
                Key = GetModelKey(model.Id), ID = id
            };

            return(e);
        }