Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }