Example #1
0
        private IClassDeclaration CreateInitialViewModel(IClassDeclaration classDeclaration, IFieldDeclaration fieldDeclaration, IConstructorDeclaration viewModelConstructor)
        {
            IConstructLanguage language  = classDeclaration.Language;
            IClassDeclaration  viewModel = language.Class(
                language.Modifiers(Modifiers.Public),
                language.None <IClassTypeParameters>(),
                language.None <ITypeName>(),
                new List <ITypeName>(),
                new List <IDeclaration>()
            {
                fieldDeclaration, viewModelConstructor
            });

            NamingPolicy classesPolicy = viewModel.PrimaryNamingPolicy(classDeclaration.FileModel.UserSettings);
            string       viewModelName = classesPolicy.MakeTypeNameUniqueInNamespace(classDeclaration, classDeclaration.Identifier.Name + "ViewModel");

            viewModel.Identifier = language.Identifier(viewModelName);
            return(viewModel);
        }