示例#1
0
        public CodeGenBase(GenieBase genie)
        {
            this.genie = genie;
            genie.Model.MetaObjects.SetUnprocessedAll();

            if (!DomainLayerConfig.IsDefined)
            {
                throw new ApplicationException("Domain layer configuration is not defined in project");
            }
            if (!ServicesLayerConfig.IsDefined)
            {
                throw new ApplicationException("Services layer configuration is not defined in project");
            }
            if (ServicesLayerConfig.BaseNamespace == Const.EmptyName)
            {
                throw new ApplicationException("Services layer configuration: base namespace is not defined");
            }

            environment = genie.Lamp.GenieLampUtils.GetEnvironmentHelper(TargetEnvironment.CSharp);
            environment.BaseNamespace = ServicesLayerConfig.ServicesNamespace;

            domainEnvironment = genie.Lamp.GenieLampUtils.GetEnvironmentHelper(TargetEnvironment.CSharp);
            domainEnvironment.BaseNamespace = DomainLayerConfig.DomainNamespace;

            interfacesEnvironment = genie.Lamp.GenieLampUtils.GetEnvironmentHelper(TargetEnvironment.CSharp);
            interfacesEnvironment.BaseNamespace = ServicesLayerConfig.ServicesInterfacesNamespace;

            dtoEnvironment = genie.Lamp.GenieLampUtils.GetEnvironmentHelper(TargetEnvironment.CSharp);
            dtoEnvironment.BaseNamespace = ServicesLayerConfig.ServicesInterfacesNamespace;

            genie.Config.Macro.SetMacro("%BASE_NAMESPACE%", ServicesLayerConfig.BaseNamespace);
            genie.Config.Macro.SetMacro("%NAMESPACE_SERVICES%", environment.BaseNamespace);
            genie.Config.Macro.SetMacro("%NAMESPACE_SERVICES_INTERFACES%", interfacesEnvironment.BaseNamespace);
            genie.Config.Macro.SetMacro("%NAMESPACE_SERVICES_DTO%", dtoEnvironment.BaseNamespace);
            genie.Config.Macro.SetMacro("%NAMESPACE_DOMAIN%", DomainLayerConfig.DomainNamespace);
            genie.Config.Macro.SetMacro("%NAMESPACE_PERSISTENCE%", DomainLayerConfig.PersistenceNamespace);

            genie.Config.Macro.SetMacro("%ClassName_PersistentObjectDTO%", NamingHelper.ClassName_PersistentObjectDTO);
            genie.Config.Macro.SetMacro("%ClassName_PersistentObjectDTOAdapter%", NamingHelper.ClassName_PersistentObjectDTOAdapter);
            genie.Config.Macro.SetMacro("%ClassName_DomainObjectDTO%", NamingHelper.ClassName_DomainObjectDTO);
            genie.Config.Macro.SetMacro("%ClassName_QueryParams%", NamingHelper.ClassName_ServicesQueryParams);
            genie.Config.Macro.SetMacro("%ClassName_QueryParam%", NamingHelper.ClassName_ServicesQueryParam);
            //genie.Config.Macro.SetMacro("%ClassName_UnitOfWork%", NamingHelper.ClassName_UnitOfWorkDTO);
            genie.Config.Macro.SetMacro("%ClassName_UnitOfWorkDTO%", NamingHelper.ClassName_UnitOfWorkDTO);
            genie.Config.Macro.SetMacro("%ClassName_UnitOfWorkDomain%", NamingHelper.ClassName_UnitOfWorkDomain);
            genie.Config.Macro.SetMacro("%ClassName_UnitOfWorkDTOAdapter%", NamingHelper.ClassName_UnitOfWorkDTOAdapter);

            genie.Config.Macro.SetMacro("%ServiceName_Persistence%", NamingHelper.ServiceName_Persistence);

            genie.Config.Macro.SetMacro("%PropertyName_InternalObjectId%", NamingHelper.PropertyName_InternalObjectId);
            genie.Config.Macro.SetMacro("%PropertyName_UnitOfWorkDTO%", NamingHelper.PropertyName_UnitOfWorkDTO);
            genie.Config.Macro.SetMacro("%PropertyName_AdapterDTO%", NamingHelper.PropertyName_AdapterDTO);
        }
 public CodeGenStackServicesHost(GenieBase genie)
     : base(genie)
 {
     outFileName = "DomainServicesHost.cs";
 }
示例#3
0
 public CodeGenDTO(GenieBase genie)
     : base(genie)
 {
     outFileName = "DomainDTO.cs";
 }