Пример #1
0
        private static string ModuleRepositoryInCommonRepositorySnippet(ModuleInfo info)
        {
            return string.Format(
                @"private {0}._Helper._ModuleRepository _{0};
        public {0}._Helper._ModuleRepository {0} {{ get {{ return _{0} ?? (_{0} = new {0}._Helper._ModuleRepository(_repositories)); }} }}

        ",
                info.Name);
        }
Пример #2
0
        private static string GenerateNamespaceSnippet(ModuleInfo info)
        {
            return string.Format(
                @"
namespace {0}
{{
    {1}

    {2}

    {3}
}}

namespace {0}._Helper
{{
    {1}

    {2}

    public class _ModuleRepository
    {{
        private readonly Rhetos.Extensibility.INamedPlugins<IRepository> _repositories;

        public _ModuleRepository(Rhetos.Extensibility.INamedPlugins<IRepository> repositories)
        {{
            _repositories = repositories;
        }}

        {4}
    }}
    {5}
}}",
                info.Name,
                DomInitializationCodeGenerator.StandardNamespacesSnippet,
                UsingTag.Evaluate(info),
                NamespaceMembersTag.Evaluate(info),
                RepositoryMembersTag.Evaluate(info),
                HelperNamespaceMembersTag.Evaluate(info));
        }
Пример #3
0
        private static string GenerateNamespaceSnippet(ModuleInfo info)
        {
            return string.Format(
                @"
            namespace {0}
            {{
            {1}

            {2}

            {3}
            }}

            namespace {0}._Helper
            {{
            {1}

            {2}

            public class _ModuleRepository
            {{
            private readonly Common.DomRepository _domRepository;
            private readonly Common.ExecutionContext _executionContext;

            public _ModuleRepository(Common.DomRepository domRepository, Common.ExecutionContext executionContext)
            {{
            _domRepository = domRepository;
            _executionContext = executionContext;
            }}
            {4}
            }}
            {5}
            }}",
                info.Name,
                DomInitializationCodeGenerator.StandardNamespacesSnippet,
                UsingTag.Evaluate(info),
                NamespaceMembersTag.Evaluate(info),
                RepositoryMembersTag.Evaluate(info),
                HelperNamespaceMembersTag.Evaluate(info));
        }
Пример #4
0
 /// <summary>
 /// Concatenates module name and data stucture name. Omits module name if it is same as the context module.
 /// </summary>
 public static string NameOptionalModule(DataStructureInfo dataStructure, ModuleInfo contextModule)
 {
     return dataStructure.Module.Name != contextModule.Name ? (dataStructure.Module.Name + dataStructure.Name) : dataStructure.Name;
 }
Пример #5
0
 /// <summary>
 /// Concatenates module name and data structure name. Omits module name if it is same as the context module.
 /// </summary>
 public static string NameOptionalModule(DataStructureInfo dataStructure, ModuleInfo contextModule)
 {
     return(dataStructure.Module.Name != contextModule.Name ? (dataStructure.Module.Name + dataStructure.Name) : dataStructure.Name);
 }