Example #1
0
        public void SyncToMeta(Repository repository, RoleType roleType)
        {
            var domain = Domain.GetDomain(roleType);

            roleType.Reset();

            if (!roleType.ExistId)
            {
                roleType.Id = this.id;
            }

            if (this.objectType != null)
            {
                var roleTypeId     = new Guid(this.objectType.idRef);
                var roleObjectType = (ObjectType)domain.Domain.Find(roleTypeId);

                if (roleObjectType == null)
                {
                    repository.AddUndefinedObjectType(this.objectType.idRef);
                    roleObjectType = domain.AddDeclaredObjectType(roleTypeId);
                }

                roleType.ObjectType = roleObjectType;
            }

            roleType.AssignedSingularName = this.singularName;
            roleType.AssignedPluralName   = this.pluralName;

            if (this.isMany != null)
            {
                roleType.IsMany = bool.Parse(this.isMany);
            }

            if (this.size != null)
            {
                roleType.Size = int.Parse(this.size);
            }

            if (this.precision != null)
            {
                roleType.Precision = int.Parse(this.precision);
            }

            if (this.scale != null)
            {
                roleType.Scale = int.Parse(this.scale);
            }
        }