public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder) { var info = (ModuleInfo)conceptInfo; codeBuilder.InsertCodeToFile( $@"namespace {info.Name} {{ {DomInitializationCodeGenerator.DisableWarnings(_commonConceptsOptions)}{DomInitializationCodeGenerator.StandardNamespacesSnippet} {UsingTag.Evaluate(info)} {NamespaceMembersTag.Evaluate(info)}{DomInitializationCodeGenerator.RestoreWarnings(_commonConceptsOptions)} }} namespace Common.Queryable {{ {DomInitializationCodeGenerator.DisableWarnings(_commonConceptsOptions)}{DomInitializationCodeGenerator.StandardNamespacesSnippet} {CommonQueryableMemebersTag.Evaluate(info)}{DomInitializationCodeGenerator.RestoreWarnings(_commonConceptsOptions)} }} ", $"{Path.Combine(GeneratedSourceDirectories.Model.ToString(), info.Name + GeneratedSourceDirectories.Model)}"); codeBuilder.InsertCodeToFile( $@"namespace {info.Name}._Helper {{ {DomInitializationCodeGenerator.DisableWarnings(_commonConceptsOptions)}{DomInitializationCodeGenerator.StandardNamespacesSnippet} {UsingTag.Evaluate(info)} public class _ModuleRepository {{ private readonly Rhetos.Extensibility.INamedPlugins<IRepository> _repositories; public _ModuleRepository(Rhetos.Extensibility.INamedPlugins<IRepository> repositories) {{ _repositories = repositories; }} {RepositoryMembersTag.Evaluate(info)} }} {HelperNamespaceMembersTag.Evaluate(info)}{DomInitializationCodeGenerator.RestoreWarnings(_commonConceptsOptions)} }} ", $"{Path.Combine(GeneratedSourceDirectories.Repositories.ToString(), info.Name + GeneratedSourceDirectories.Repositories)}"); codeBuilder.InsertCode(ModuleRepositoryInCommonRepositorySnippet(info), CommonDomRepositoryMembersTag); }
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder) { var info = (ModuleInfo)conceptInfo; codeBuilder.InsertCodeToFile( $@"namespace {info.Name} {{ {DomInitializationCodeGenerator.DisableWarnings(_commonConceptsOptions)}{DomInitializationCodeGenerator.StandardNamespacesSnippet} {UsingTag.Evaluate(info)} {NamespaceMembersTag.Evaluate(info)}{DomInitializationCodeGenerator.RestoreWarnings(_commonConceptsOptions)} }} namespace Common.Queryable {{ {DomInitializationCodeGenerator.DisableWarnings(_commonConceptsOptions)}{DomInitializationCodeGenerator.StandardNamespacesSnippet} {CommonQueryableMemebersTag.Evaluate(info)}{DomInitializationCodeGenerator.RestoreWarnings(_commonConceptsOptions)} }} ", $"{DomAssemblies.Model}\\{info.Name}{DomAssemblies.Model}"); codeBuilder.InsertCodeToFile( $@"namespace {info.Name}._Helper {{ {DomInitializationCodeGenerator.DisableWarnings(_commonConceptsOptions)}{DomInitializationCodeGenerator.StandardNamespacesSnippet} {UsingTag.Evaluate(info)} public class _ModuleRepository {{ private readonly Rhetos.Extensibility.INamedPlugins<IRepository> _repositories; public _ModuleRepository(Rhetos.Extensibility.INamedPlugins<IRepository> repositories) {{ _repositories = repositories; }} {RepositoryMembersTag.Evaluate(info)} }} {HelperNamespaceMembersTag.Evaluate(info)}{DomInitializationCodeGenerator.RestoreWarnings(_commonConceptsOptions)} }} ", $"{DomAssemblies.Repositories}\\{info.Name}{DomAssemblies.Repositories}"); // Default .NET framework assemblies: codeBuilder.AddReferencesFromDependency(typeof(int)); // Includes reference to mscorlib.dll codeBuilder.AddReferencesFromDependency(typeof(Enumerable)); // Includes reference to System.Core, a default reference for new project in Visual Studio. codeBuilder.AddReferencesFromDependency(typeof(ISet <>)); // Includes reference to System, a default reference for new project in Visual Studio. codeBuilder.AddReferencesFromDependency(typeof(Microsoft.CSharp.RuntimeBinder.RuntimeBinderException)); // Includes reference to Microsoft.CSharp, a default reference for new project in Visual Studio. codeBuilder.AddReferencesFromDependency(typeof(System.Data.Common.DbDataReader)); // Includes reference to System.Data, a default reference for new project in Visual Studio. codeBuilder.AddReferencesFromDependency(typeof(System.Data.DataRowExtensions)); // Includes reference to System.Data.DataSetExtensions, a default reference for new project in Visual Studio. codeBuilder.AddReferencesFromDependency(typeof(System.Xml.Serialization.XmlSerializer)); // Includes reference to System.Xml, a default reference for new project in Visual Studio. codeBuilder.AddReferencesFromDependency(typeof(System.Xml.Linq.XElement)); // Includes reference to System.Xml.Linq, a default reference for new project in Visual Studio. // Commonly used Rhetos classes: codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Dom.DefaultConcepts.FilterAll)); // Includes reference to Rhetos.Dom.DefaultConcepts.dll codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Extensibility.INamedPlugins <>)); // Other classes used in domain object model: codeBuilder.AddReferencesFromDependency(typeof(System.Runtime.Serialization.DataContractAttribute)); // Includes reference to System.Runtime.Serialization.dll. codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Persistence.IPersistenceTransaction)); codeBuilder.InsertCode(ModuleRepositoryInCommonRepositorySnippet(info), CommonDomRepositoryMembersTag); }