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); } }
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 { } } }
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 { } } }