Example #1
0
        private SetBaseTypeChunk TransformChunk(SetBaseTypeChunk setBaseTypeChunk)
        {
            var typeName = ChunkHelper.ReplaceTModel(setBaseTypeChunk.TypeName, _modelType);

            if (typeName != setBaseTypeChunk.TypeName)
            {
                return(new SetBaseTypeChunk
                {
                    TypeName = typeName,
                    Start = setBaseTypeChunk.Start,
                    Association = setBaseTypeChunk.Association
                });
            }
            return(setBaseTypeChunk);
        }
Example #2
0
        public void Visit_UpdatesTModelTokenToMatchModelType(string typeName, string expectedValue)
        {
            // Arrange
            var chunk = new SetBaseTypeChunk
            {
                TypeName = typeName,
            };
            var merger = new SetBaseTypeChunkMerger("Person");

            // Act
            merger.VisitChunk(chunk);

            // Assert
            Assert.Equal(expectedValue, chunk.TypeName);
        }
        protected override void Visit(SetBaseTypeChunk chunk)
        {
            if (Context.Host.DesignTimeMode)
            {
                using (CSharpLineMappingWriter lineMappingWriter = Writer.BuildLineMapping(chunk.Start, chunk.TypeName.Length, Context.SourceFile))
                {
                    Writer.Indent(chunk.Start.CharacterIndex);

                    lineMappingWriter.MarkLineMappingStart();
                    Writer.Write(chunk.TypeName);
                    lineMappingWriter.MarkLineMappingEnd();

                    Writer.Write(" ").Write(InheritsHelper).Write(" = null;");
                }
            }
        }
 protected override void Visit(SetBaseTypeChunk chunk)
 {
 }
 protected virtual void Visit(SetBaseTypeChunk chunk)
 {
 }
 protected override void Visit(SetBaseTypeChunk chunk)
 {
     CurrentBaseType = chunk.TypeName;
 }
 protected abstract void Visit(SetBaseTypeChunk chunk);