コード例 #1
0
        // Constructors

        internal TypeDef(ModelDefBuilder builder, Type type, Validator validator)
        {
            this.builder   = builder;
            underlyingType = type;
            this.validator = validator;

            if (type.IsInterface)
            {
                Attributes = TypeAttributes.Interface;
            }
            else if (type == typeof(Structure) || type.IsSubclassOf(typeof(Structure)))
            {
                Attributes = TypeAttributes.Structure;
            }
            else
            {
                Attributes = type.IsAbstract
          ? TypeAttributes.Entity | TypeAttributes.Abstract
          : TypeAttributes.Entity;
            }

            if (type.IsGenericTypeDefinition)
            {
                Attributes = Attributes | TypeAttributes.GenericTypeDefinition;
            }

            fields       = new NodeCollection <FieldDef>(this, "Fields");
            indexes      = new NodeCollection <IndexDef>(this, "Indexes");
            implementors = IsInterface
        ? new NodeCollection <TypeDef>(this, "Implementors")
        : NodeCollection <TypeDef> .Empty;

            Validators = new List <IObjectValidator>();
        }
コード例 #2
0
        // Constructors

        internal DomainModelDef(ModelDefBuilder builder, Validator validator)
        {
            this.builder   = builder;
            this.validator = validator;

            types           = new TypeDefCollection(this, "Types");
            hierarchies     = new HierarchyDefCollection();
            fullTextIndexes = new FullTextIndexDefCollection();

            types.Removed += OnTypeRemoved;
            types.Cleared += OnTypesCleared;
        }