Exemplo n.º 1
0
        protected override void LoadMetaData()
        {
            EntityMetadata meta;

            meta = new EntityMetadata()
            {
                EntityType = typeof(Actor), Container = Actors
            };
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Actor)e).User));
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Actor)e).Room));
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Actor)e).ClassTemplate));
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Actor)e).RaceTemplate));
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => Actor.GenerateInsertCommand(c, (Actor)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => Actor.GenerateUpdateCommand(c, (Actor)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => Actor.GenerateDeleteCommand(c, (Actor)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(ClassTemplate), Container = ClassTemplates
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => ClassTemplate.GenerateInsertCommand(c, (ClassTemplate)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => ClassTemplate.GenerateUpdateCommand(c, (ClassTemplate)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => ClassTemplate.GenerateDeleteCommand(c, (ClassTemplate)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(Currency), Container = Currencies
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => Currency.GenerateInsertCommand(c, (Currency)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => Currency.GenerateUpdateCommand(c, (Currency)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => Currency.GenerateDeleteCommand(c, (Currency)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(Item), Container = Items
            };
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Item)e).ItemTemplate));
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Item)e).Actor));
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Item)e).Room));
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => Item.GenerateInsertCommand(c, (Item)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => Item.GenerateUpdateCommand(c, (Item)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => Item.GenerateDeleteCommand(c, (Item)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(ItemTemplate), Container = ItemTemplates
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => ItemTemplate.GenerateInsertCommand(c, (ItemTemplate)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => ItemTemplate.GenerateUpdateCommand(c, (ItemTemplate)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => ItemTemplate.GenerateDeleteCommand(c, (ItemTemplate)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(RaceTemplate), Container = RaceTemplates
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => RaceTemplate.GenerateInsertCommand(c, (RaceTemplate)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => RaceTemplate.GenerateUpdateCommand(c, (RaceTemplate)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => RaceTemplate.GenerateDeleteCommand(c, (RaceTemplate)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(Region), Container = Regions
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => Region.GenerateInsertCommand(c, (Region)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => Region.GenerateUpdateCommand(c, (Region)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => Region.GenerateDeleteCommand(c, (Region)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(Room), Container = Rooms
            };
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Room)e).Region));
            meta.Relationships.Add(new EntityRelationship((IEntity e) => ((Room)e).TextBlock));
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => Room.GenerateInsertCommand(c, (Room)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => Room.GenerateUpdateCommand(c, (Room)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => Room.GenerateDeleteCommand(c, (Room)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(Setting), Container = Settings
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => Setting.GenerateInsertCommand(c, (Setting)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => Setting.GenerateUpdateCommand(c, (Setting)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => Setting.GenerateDeleteCommand(c, (Setting)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(TextBlock), Container = TextBlocks
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => TextBlock.GenerateInsertCommand(c, (TextBlock)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => TextBlock.GenerateUpdateCommand(c, (TextBlock)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => TextBlock.GenerateDeleteCommand(c, (TextBlock)e);
            EntityTypes.Add(meta);

            meta = new EntityMetadata()
            {
                EntityType = typeof(User), Container = Users
            };
            meta.GenerateInsertCommand = (SqlCommand c, IEntity e) => User.GenerateInsertCommand(c, (User)e);
            meta.GenerateUpdateCommand = (SqlCommand c, IEntity e) => User.GenerateUpdateCommand(c, (User)e);
            meta.GenerateDeleteCommand = (SqlCommand c, IEntity e) => User.GenerateDeleteCommand(c, (User)e);
            EntityTypes.Add(meta);

            this.LinkTypes.Add(RaceClassRestrictions);
        }
Exemplo n.º 2
0
 public static void GenerateDeleteCommand(SqlCommand c, ClassTemplate e)
 {
     c.CommandText = @"DELETE FROM[ClassTemplate] WHERE[Id] = @Id";
     c.Parameters.Clear();
     c.Parameters.AddWithValue("@Id", e.Id);
 }
Exemplo n.º 3
0
 public static void GenerateInsertCommand(SqlCommand c, ClassTemplate e)
 {
     c.CommandText = @"INSERT INTO [ClassTemplate]([Id], [Name], [Description], [Stats])
                       VALUES (@Id, @Name, @Description, @Stats)";
     AddSqlParameters(c, e);
 }
Exemplo n.º 4
0
 public static void GenerateUpdateCommand(SqlCommand c, ClassTemplate e)
 {
     c.CommandText = @"UPDATE [ClassTemplate] SET [Id] = @Id, [Name] = @Name, [Description] = @Description, [Stats] = @Stats WHERE [Id] = @Id";
     AddSqlParameters(c, e);
 }
Exemplo n.º 5
0
 partial void OnClassTemplateChanging(ClassTemplate oldValue, ClassTemplate newValue);