Esempio n. 1
0
        private async Task <UserType> EnsureBaseUserTypeAsync(UserType model, CrudOperation crudOperation)
        {
            if (string.IsNullOrEmpty(model.BaseUserType))
            {
                model.BaseUserType = OriginUserType.Name;
            }

            var baseUserType = await this.GetBaseUserTypeAsync(model.MembershipId, model.BaseUserType);

            if (baseUserType == null)
            {
                throw ErtisAuthException.InheritedTypeNotFound(model.BaseUserType);
            }

            if (baseUserType.IsSealed)
            {
                throw ErtisAuthException.InheritedTypeIsSealed(model.BaseUserType);
            }

            model.Properties = new ReadOnlyCollection <IFieldInfo>(model.MergeTypeProperties(baseUserType, crudOperation is CrudOperation.Update or CrudOperation.Create).ToList());

            return(model);
        }