Пример #1
0
        protected override IStep GetInsertEntityStep(IArtist entity)
        {
            var step = new Step("insert into Artist (Type, Name, Year) values (@Type, @Name, @Year); select last_insert_rowid();");

            step.AddItem("@Type", (ushort)entity.Type);
            step.AddItem("@Name", entity.Name);
            step.AddItem("@Year", entity.Year);

            return(step);
        }
Пример #2
0
        protected override IStep GetUpdateEntityStep(uint id, IArtist entity)
        {
            var step = new Step("update Artist set Type = @Type, Name = @Name, Year = @Year where Id = @Id;");

            step.AddItem("@Type", (ushort)entity.Type);
            step.AddItem("@Name", entity.Name);
            step.AddItem("@Year", entity.Year);
            step.AddItem("@Id", id);

            return(step);
        }
        protected virtual IStep GetInsertTagStep(ITag tag, uint entityId)
        {
            var step = new Step(insertTagCommandText);

            step.AddItem(parentParameterName, entityId);
            step.AddItem("@Name", tag.Name);
            step.AddItem("@Category", (ushort)tag.Category);
            step.AddItem("@Source", (ushort)tag.Source);

            return(step);
        }
        protected virtual IStep GetInsertLinkStep(ILink link, uint entityId)
        {
            var step = new Step(insertLinkCommandText);

            step.AddItem(parentParameterName, entityId);
            step.AddItem("@Name", link.Name);
            step.AddItem("@Relationship", (ushort)link.Relationship);
            step.AddItem("@Source", (ushort)link.Source);
            step.AddItem("@Target", link.Target);

            return(step);
        }
        protected override IStep GetUpdateEntityStep(uint id, IWork entity)
        {
            var step = new Step("update Work set Type = @Type, Parent = @Parent, Artist = @Artist, Name = @Name, Year = @Year, Number = @Number where Id = @Id;");

            step.AddItem("@Type", (ushort)entity.Type);
            step.AddItem("@Parent", workCache.GetId(entity.Parent));
            step.AddItem("@Artist", artistCache.GetId(entity.Artist));
            step.AddItem("@Name", entity.Name);
            step.AddItem("@Year", entity.Year);
            step.AddItem("@Number", entity.Number);
            step.AddItem("@Id", id);

            return(step);
        }
        protected override IStep GetInsertEntityStep(IWork entity)
        {
            var step = new Step("insert into Work (Type, Parent, Artist, Name, Year, Number) values (@Type, @Parent, @Artist, @Name, @Year, @Number); select last_insert_rowid();");

            step.AddItem("@Type", (ushort)entity.Type);
            step.AddItem("@Parent", workCache.GetId(entity.Parent));
            step.AddItem("@Artist", artistCache.GetId(entity.Artist));
            step.AddItem("@Name", entity.Name);
            step.AddItem("@Year", entity.Year);
            step.AddItem("@Number", entity.Number);

            return(step);
        }