Beispiel #1
0
        public Entity(Model model, XmlNode node) : base(model, node)
        {
            Init();

            supertypeName = new QualName(node, "supertypeSchema", "supertype", this.Schema);
            if (!supertypeName.IsEmpty)
            {
                Type t = Model.Types.FindType(supertypeName);
                if (t == null)
                {
                    throw new GlException("Supertype \"{0}\" not found. Entity: {1}", supertypeName.FullName, FullName);
                }
                supertype = (t as EntityType).Entity;
            }

            Model.Generators.AddList(this, Model.QueryNode(node, "./{0}:Generator"));

            persistence = new Persistence(this, node);
            if (!Persistence.SchemaDefined)
            {
                this.Persistence.Schema = Model.DefaultPersistentSchema;
                this.Persistence.LockSchema();
            }
            attributes  = new EntityAttributes(this, node);
            constraints = new EntityConstraints(this, node);

            this.EventHandlers = new EntityEventHandlers(this, node);
            this.Operations    = new EntityOperations(this, node);

            Model.PhysicalModel.Indexes.AddList(this, Model.QueryNode(node, "./{0}:Index"));
        }
Beispiel #2
0
 private void Init()
 {
     type               = Model.Types.AddEntityType(this);
     relations          = new Relations(Model);
     parents            = new Relations(Model);
     children           = new Relations(Model);
     oneToOne           = new Relations(Model);
     manyToMany         = new Relations(Model);
     attributes         = new EntityAttributes(this);
     constraints        = new EntityConstraints(this);
     this.EventHandlers = new EntityEventHandlers(this);
     this.Operations    = new EntityOperations(this);
 }