Esempio n. 1
0
 public virtual void SetViewModel(IInt64Key model = null)
 {
     if (model != null)
     {
         var type = model.GetType().GetRealType();
         FullType     = type.FullName;
         ThisAssembly = type.Assembly.FullName;
         model.SetObjectByObject(this);
     }
 }
Esempio n. 2
0
        public static void Create(this IInt64Key model, ISave repo)
        {
            var type      = model.GetType().GetRealType();
            var repoType  = repo.GetType();
            var addMethod = repo.GetMethod(type, "Add", out object p);

            if (addMethod != null)
            {
                try
                {
                    addMethod.Invoke(p, new object[1] {
                        model
                    });
                    repo.SaveChanges();
                }
                catch
                {
                }
            }
        }
Esempio n. 3
0
        public virtual void Create(IInt64Key model, ISave repo)
        {
            if (model == null || repo == null)
            {
                return;
            }
            var type      = model.GetType().GetRealType();
            var repoType  = repo.GetType();
            var addMethod = repo.GetMethod(type, "Add", out object p);

            if (addMethod != null)
            {
                try
                {
                    addMethod.Invoke(p, new object[1] {
                        model
                    });
                    repo.SaveChanges();
                }
                catch
                {
                }
            }
        }