private void InsertOrUpdate(User @new, User old) { ((IPersistable)@new).OnSaving(); DataHelper.StoreObject(@new, @new.UUID, ModelExtensions.UserDataType); ((IPersistable)@new).OnSaved(); }
public static SiteUserEntity ToEntity(this Kooboo.CMS.Sites.Models.User user, SiteUserEntity entity = null) { if (entity == null) { entity = new SiteUserEntity(); } entity.SiteName = user.Site.Name; entity.UserName = user.UserName; entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(user); return(entity); }
public static Kooboo.CMS.Sites.Models.User ToUser(this SiteUserEntity entity) { if (entity == null) { return null; } var dummy = new Kooboo.CMS.Sites.Models.User() { Site = new Site(entity.SiteName), UserName = entity.UserName }; var user = DataContractSerializationHelper.DeserializeFromXml<Kooboo.CMS.Sites.Models.User>(entity.ObjectXml); ((IPersistable)user).Init(dummy); return user; }
public static Kooboo.CMS.Sites.Models.User ToUser(this SiteUserEntity entity) { if (entity == null) { return(null); } var dummy = new Kooboo.CMS.Sites.Models.User() { Site = new Site(entity.SiteName), UserName = entity.UserName }; var user = DataContractSerializationHelper.DeserializeFromXml <Kooboo.CMS.Sites.Models.User>(entity.ObjectXml); ((IPersistable)user).Init(dummy); return(user); }
public DataFilePath(User user) { this.PhysicalPath = Path.Combine(GetBasePath(user.Site), user.UserName + ".config"); }