示例#1
0
        protected virtual void CreateRouteDefinition()
        {
            routeDefinition = sourceGenerator.GenerateTypeDeclaration(@namespace, node.Name + "Route", routeDefinitions.Name);
            AddRouteDefinitionBaseType();

            routeDefinition.Members.Add(
                CreateConstructor.WithParameters()
                .WithAttributes(MemberAttributes.Public)
                .WithBaseConstructorArgs(GetRouteDefinitionBaseConstructorArgs())
                .Constructor);
        }
示例#2
0
        protected virtual CodeTypeDeclaration GenerateTypeDeclaration(string ns, string name)
        {
            CodeTypeDeclaration type = _source.GenerateTypeDeclaration(ns, name);

            CreateMemberFields(type);

            CodeConstructor constructor = _constructor = CreateServicesConstructor();

            constructor.Statements.Add(
                new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), _naming.ToMemberVariableName(_serviceIdentifier)),
                                        new CodeArgumentReferenceExpression(_naming.ToVariableName(_serviceIdentifier))));
            type.Members.Add(constructor);
            return(type);
        }