示例#1
0
        protected Database(IPersistenceConfigurer pcfg, IDomainDefinition mappings)
        {
            var  clsmaps = new DomainType[]{DomainType.Class,DomainType.ClassWithoutBaseClass};
            var cfg = Fluently.Configure()
                .Database(pcfg)
                .Mappings(m =>
                {
                    var am1 = AutoMap.Assembly(mappings.DomainAssembly)
                        .Where(t => clsmaps.Contains(mappings.GetDomainType(t)))
                       .Setup(c =>
                       {
                           c.IsComponentType = t => typeof(MyText).IsAssignableFrom(t) ||
                               mappings.GetDomainType(t) == DomainType.Component;
                           c.IsConcreteBaseType = t => IsConcreteBaseType(t) ||
                               mappings.GetDomainType(t) == DomainType.ClassWithoutBaseClass;
                           c.GetComponentColumnPrefix = pi =>
                           {
                               return pi.Name;
                           };
                       });

                    foreach (var mod in mappings.RegisteredModules)
                        mod.Map(mappings, am1);

                    am1.GetType().GetMethod("UseOverridesFromAssemblyOf").MakeGenericMethod(mappings.GetType()).Invoke(am1, null);
                    am1.Alterations(a =>
                    {
                        a.GetType().GetMethod("AddFromAssemblyOf").MakeGenericMethod(mappings.GetType()).Invoke(a, null);
                    });
                    m.AutoMappings.Add(am1);

                    if (mappings.WriteHbmFilesToPath != null)
                    {
                        foreach (var v in m.AutoMappings)
                        {
                            v.BuildMappings();
                            v.WriteMappingsTo(mappings.WriteHbmFilesToPath);
                        }
                    }
                }).ExposeConfiguration(c =>
                {
                    foreach (var mod in mappings.RegisteredModules)
                        mod.Configure(c);
                }).BuildConfiguration();
            SessionFactory = cfg.BuildSessionFactory();

            CreateDB = () =>
            {
                LocalSession = LocalSession??SessionFactory.OpenSession();
                new SchemaExport(cfg).Execute(false, true, false, LocalSession.Connection, null);
            };
            UpdateDB = () =>
            {
                new SchemaUpdate(cfg).Execute(false, true);
            };
            DropDB = () =>
            {
                new SchemaExport(cfg).Drop(true, true);
            };
        }
示例#2
0
		/// <summary>
		/// f(x) を計算。
		/// </summary>
		/// <param name="x">x</param>
		/// <returns>f(x)</returns>
		public ValueType Value(DomainType x)
		{
			int n=coef.Length-1;
			ValueType y = this.coef[n];

			while(n > 0)
			{
				y *= x;
				--n;
				y += this.coef[n];
			}

			return y;
		}
示例#3
0
        public static DomainType getDomainOfLinkVariable(SQLRepository repository, SQLConnector tggLv)
        {
            TGGObjectVariable supplier = new TGGObjectVariable(repository.GetElementByID(tggLv.SupplierID), repository);
            TGGObjectVariable client   = new TGGObjectVariable(repository.GetElementByID(tggLv.ClientID), repository);

            DomainType supplierDom = getDomainOfObjectVariable(repository, supplier);
            DomainType clientDom   = getDomainOfObjectVariable(repository, client);

            if (!supplierDom.Equals(clientDom))
            {
                return(DomainType.CORRESPONDENCE);
            }
            else
            {
                return(supplierDom);
            }
        }
示例#4
0
        private static DomainType CreateParameter(string parameterName, params string[] values)
        {
            DomainType param = new DomainType();
            List <GeosyncWCF.ValueType> valuelist = new List <GeosyncWCF.ValueType>();

            foreach (string s in values)
            {
                GeosyncWCF.ValueType val = new GeosyncWCF.ValueType();
                val.Value = s;
                valuelist.Add(val);
            }
            param.AllowedValues = valuelist.ToArray();

            param.name = parameterName;

            return(param);
        }
示例#5
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง DOMAINTYPE
    /// </summary>
    /// <param name="DomainTypeCode">รหัสประเภทคุณลักษณะพิเศษ</param>
    /// <returns>ข้อมูลจากตาราง DOMAINTYPE</returns>
    public DomainType getDomainType(string DomainTypeCode)
    {
        DomainType DomainTypeData = new DomainType();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From DOMAINTYPE Where DOMAINTYPECODE='" + DomainTypeCode + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            DomainTypeData.DomainTypeCode = rowData["DOMAINTYPECODE"].ToString();
            DomainTypeData.DomainName     = rowData["DOMAINNAME"].ToString();
        }

        return(DomainTypeData);
    }
        public static DomainReference Parse(string fullName, DomainType domainType)
        {
            DomainReference d     = null;
            Match           match = null;

            if (!String.IsNullOrEmpty(fullName))
            {
                switch (domainType)
                {
                case DomainType.Set:

                    match = Regex.Match(fullName, String.Format("^{0}$", Utilities.CONSTANTS.SET_REGEX));

                    if (match.Success)
                    {
                        d           = new DomainReference();
                        d.Type      = domainType;
                        d.Name      = match.Groups["name"].Value;
                        d.OwnerName = match.Groups["ownerName"].Success ? match.Groups["ownerName"].Value : null;
                    }

                    break;

                case DomainType.Subverse:
                    match = Regex.Match(fullName, String.Format("^{0}$", Utilities.CONSTANTS.SUBVERSE_REGEX));

                    if (match.Success)
                    {
                        d           = new DomainReference();
                        d.Type      = domainType;
                        d.Name      = match.Value;
                        d.OwnerName = null;
                    }

                    break;

                default:

                    break;
                }
            }
            return(d);
        }
示例#7
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง DOMAINTYPE
    /// </summary>
    /// <returns>ข้อมูลจากตาราง DOMAINTYPE</returns>
    public List <DomainType> getDomainType()
    {
        List <DomainType> DomainTypeData = new List <DomainType>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From DOMAINTYPE Order By DOMAINTYPECODE";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            DomainType DomainTypeRow = new DomainType();

            DomainTypeRow.DomainTypeCode = rowData["DOMAINTYPECODE"].ToString();
            DomainTypeRow.DomainName     = rowData["DOMAINNAME"].ToString();

            DomainTypeData.Add(DomainTypeRow);
        }

        return(DomainTypeData);
    }
示例#8
0
        private static DomainType determineDomainUsingConnectivity(TGGObjectVariable tggOv, SQLRepository repository, HashSet <int> alreadyVisited)
        {
            alreadyVisited.Add(tggOv.sqlElement.ElementID);

            DomainType result = DomainType.UNDEFINED;

            result = determineDomainSimple(repository, tggOv);
            if (result != DomainType.UNDEFINED)
            {
                return(result);
            }

            result = determineDomainUsingDirectCorrespondence(tggOv, repository);
            if (result != DomainType.UNDEFINED)
            {
                return(result);
            }

            int itsID = tggOv.sqlElement.ElementID;

            foreach (SQLConnector connector in tggOv.sqlElement.Connectors)
            {
                SQLElement client    = repository.GetElementByID(connector.ClientID);
                SQLElement supplier  = repository.GetElementByID(connector.SupplierID);
                SQLElement neighbour = client.ElementID == itsID ? supplier : client;

                if (!alreadyVisited.Contains(neighbour.ElementID) && neighbour.Stereotype == TGGModelingMain.TggObjectVariableStereotype)
                {
                    DomainType neigbourDomain = determineDomainUsingConnectivity(new TGGObjectVariable(neighbour, repository), repository, alreadyVisited);
                    if (neigbourDomain != DomainType.UNDEFINED)
                    {
                        return(neigbourDomain);
                    }
                }
            }

            return(DomainType.UNDEFINED);
        }
示例#9
0
        public SpecificSolverHeuristic(PAD.Planner.IProblem problem, DomainType domain) : base(problem)
        {
            switch (domain)
            {
            case DomainType.Zeno:
                solver = new PADD.DomainDependentSolvers.Zenotravel.ZenotravelSolver(20, 5);
                break;

            case DomainType.VisitAll:
                solver = new PADD.DomainDependentSolvers.VisitAll.VisitAllSolver();
                break;

            case DomainType.Blocks:
                solver = new PADD.DomainDependentSolvers.BlocksWorld.BlocksWorldSolver();
                break;

            case DomainType.TSP:
                throw new Exception();

            default:
                throw new Exception();
            }
            this.Statistics.DoMeasure = false;
        }
示例#10
0
 /// <remarks/>
 public void AddDomainWithProvisioningAsync(int packageId, string domainName, DomainType domainType, bool createWebSite, int pointWebSiteId, int pointMailDomainId, bool createDnsZone, bool createInstantAlias, bool allowSubDomains, string hostName, object userState) {
     if ((this.AddDomainWithProvisioningOperationCompleted == null)) {
         this.AddDomainWithProvisioningOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddDomainWithProvisioningOperationCompleted);
     }
     this.InvokeAsync("AddDomainWithProvisioning", new object[] {
                 packageId,
                 domainName,
                 domainType,
                 createWebSite,
                 pointWebSiteId,
                 pointMailDomainId,
                 createDnsZone,
                 createInstantAlias,
                 allowSubDomains,
                 hostName}, this.AddDomainWithProvisioningOperationCompleted, userState);
 }
示例#11
0
		public static Polynomial Lagrange(DomainType[] x, DomainType[] y)
		{
			if(x.Length != y.Length)
				throw new System.ArgumentException("x と y の次数は等しくなければいけません。");

			int len = x.Length;
			Polynomial p = (Polynomial)(CoefType)0.0;
			Polynomial X = Polynomial.X(1);

			for(int i=0; i<len; ++i)
			{
				Polynomial q = (Polynomial)(CoefType)y[i];

				for(int j=0; j<len; ++j)
				{
					if(i == j) continue;

					Polynomial temp = (X - (CoefType)x[j]);
					temp /= (x[i] - x[j]);
					q *= (X - (CoefType)x[j]) / (x[i] - (CoefType)x[j]);
				}
				p += q;
			}

			return p;
		}
示例#12
0
 public int AddDomainWithProvisioning(int packageId, string domainName, DomainType domainType,
     bool createWebSite, int pointWebSiteId, int pointMailDomainId,
     bool createDnsZone, bool createInstantAlias, bool allowSubDomains, string hostName)
 {
     return ServerController.AddDomainWithProvisioning(packageId, domainName, domainType,
                 createWebSite, pointWebSiteId, pointMailDomainId,
                 createDnsZone, createInstantAlias, allowSubDomains, hostName);
 }
示例#13
0
        public static int AddDomainWithProvisioning(int packageId, string domainName, DomainType domainType,
            bool createWebSite, int pointWebSiteId, int pointMailDomainId,
            bool createDnsZone, bool createInstantAlias, bool allowSubDomains)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // check package
            int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
            if (packageCheck < 0) return packageCheck;
            
            // set flags
            bool isSubDomain = (domainType == DomainType.SubDomain || domainType == DomainType.ProviderSubDomain);
            bool isDomainPointer = (domainType == DomainType.DomainPointer);

            // check services
            bool dnsEnabled = (PackageController.GetPackageServiceId(packageId, ResourceGroups.Dns) > 0);
            bool webEnabled = (PackageController.GetPackageServiceId(packageId, ResourceGroups.Web) > 0);
            bool mailEnabled = (PackageController.GetPackageServiceId(packageId, ResourceGroups.Mail) > 0);

            // add main domain
            int domainId = AddDomainInternal(packageId, domainName, createDnsZone && dnsEnabled, isSubDomain, false, isDomainPointer, allowSubDomains);
            if (domainId < 0)
                return domainId;

            // add instant alias
            createInstantAlias &= (domainType != DomainType.DomainPointer);
            if (createInstantAlias)
            {
                // check if instant alias is configured
                string domainAlias = GetDomainAlias(packageId, domainName);

                // add instant alias if required
                if (!String.IsNullOrEmpty(domainAlias))
                {
                    // add alias
                    AddDomainInternal(packageId, domainAlias, dnsEnabled, false, true, false, false);
                }
            }

            // create web site if requested
            int webSiteId = 0;
            if (webEnabled && createWebSite)
            {
                webSiteId = WebServerController.AddWebSite(
                    packageId, domainId, 0, createInstantAlias);

                if (webSiteId < 0)
                {
                    // return
                    return webSiteId;
                }
            }

            // add web site pointer
            if (webEnabled && domainType == DomainType.DomainPointer && pointWebSiteId > 0)
            {
                WebServerController.AddWebSitePointer(pointWebSiteId, domainId);
            }

            // add mail domain pointer
            if (mailEnabled && domainType == DomainType.DomainPointer && pointMailDomainId > 0)
            {
                MailServerController.AddMailDomainPointer(pointMailDomainId, domainId);
            }

            return domainId;
        }
示例#14
0
文件: Domain.cs 项目: iS3-Project/iS3
        public Domain(string domainName, DomainType domainType)
        {
            name = domainName;
            type = domainType;

            root = new Tree();
            root.Name = name;

            objsDefinitions = new Dictionary<string, DGObjectsDefinition>();
            objsContainer = new Dictionary<string, DGObjects>();
        }
示例#15
0
        public void NewDomain(string domainName, DomainType domainType)
        {
            try
            {
                PSCommand cmd = new PSCommand();
                cmd.AddCommand("New-AcceptedDomain");
                cmd.AddParameter("Name", domainName);
                cmd.AddParameter("DomainName", domainName);
                cmd.AddParameter("DomainController", domainController);

                switch (domainType)
                {
                    case DomainType.InternalRelayDomain:
                        cmd.AddParameter("DomainType", "InternalRelay");
                        break;
                    case DomainType.ExternalRelayDomain:
                        cmd.AddParameter("DomainType", "ExternalRelay");
                        break;
                    default:
                        cmd.AddParameter("DomainType", "Authoritative");
                        break;
                }

                powershell.Commands = cmd;
                powershell.Invoke();

                if (powershell.HadErrors)
                    throw powershell.Streams.Error[0].Exception;
            }
            catch (Exception ex)
            {
                this.logger.Error("Failed enable new accepted domain " + domainName, ex);
                throw;
            }
        }
示例#16
0
        public void UpdateDomain(string domainName, DomainType domainType)
        {
            try
            {
                this.logger.Debug("Updating accepted domain " + domainName + " to " + domainType.ToString());

                PSCommand cmd = new PSCommand();
                cmd.AddCommand("Set-AcceptedDomain");
                cmd.AddParameter("Identity", domainName);
                cmd.AddParameter("DomainController", domainController);

                switch (domainType)
                {
                    case DomainType.InternalRelayDomain:
                        cmd.AddParameter("DomainType", "InternalRelay");
                        break;
                    case DomainType.ExternalRelayDomain:
                        cmd.AddParameter("DomainType", "ExternalRelay");
                        break;
                    default:
                        cmd.AddParameter("DomainType", "Authoritative");
                        break;
                }

                powershell.Commands = cmd;
                powershell.Invoke();

                if (powershell.HadErrors)
                    throw powershell.Streams.Error[0].Exception;
            }
            catch (Exception ex)
            {
                this.logger.Error("Failed to update accepted domain " + domainName, ex);
                throw;
            }
        }
		/// <summary>
		/// Creates a new <see cref="AppDomainManager"/> instance.
		/// </summary>
		/// <param name="domainName">Name of the domain.</param>
		/// <param name="configurationFile">Configuration file.</param>
		/// <param name="shadowCopyDirectories">Shadow copy directories.</param>
		public AppDomainManager(string basedir, string domainName, string configurationFile, params string[] shadowCopyDirectories)
		{
			this.domainName = domainName;
			this.domainType = DomainType.Remote;

			if(log.IsDebugEnabled) log.Debug("Loading new AppDomainManager");

			Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
			Evidence evidence = new Evidence(baseEvidence);

			AppDomainSetup setup = new AppDomainSetup();
			setup.ApplicationBase = basedir;
			setup.ApplicationName = "Test";
			if(configurationFile.Length > 0) setup.ConfigurationFile = configurationFile;

			if(log.IsDebugEnabled)
			{
				log.Debug("ApplicationBase: " + setup.ApplicationBase);
				log.Debug("ApplicationName: " + setup.ApplicationName);
				log.Debug("ConfigurationFile: " + setup.ConfigurationFile);
			}

			if(shadowCopyDirectories != null && shadowCopyDirectories.Length >= 0)
			{
				guid = System.Guid.NewGuid().ToString();
				setup.ShadowCopyFiles = "true";
				setup.CachePath = this.GetCachePath();
				foreach (string shadowCopyDirectory in shadowCopyDirectories)
				{
					string dir = String.Empty;

					if(File.Exists(shadowCopyDirectory))
					{
						// if it's a file, grab the directory name
						FileInfo f = new FileInfo(shadowCopyDirectory);
						dir = f.DirectoryName;
					}
					else
					{
						dir = shadowCopyDirectory;
					}
					
					if(setup.ShadowCopyDirectories != null && setup.ShadowCopyDirectories.Length > 0)
					{
						setup.ShadowCopyDirectories += ";" + dir;
					}
					else
					{
						setup.ShadowCopyDirectories += dir;
					}
				}
			}

			domain = AppDomain.CreateDomain(this.domainName, evidence, setup);
			remote = (AppDomainManager)domain.CreateInstanceAndUnwrap(typeof(AppDomainManager).Assembly.FullName, typeof(AppDomainManager).FullName);
		}
示例#18
0
		/// <summary>
		/// f(x) を計算。
		/// </summary>
		/// <param name="x">x</param>
		/// <returns>f(x)</returns>
		public ValueType Value(DomainType x)
		{
			return this.num.Value(x) / this.denom.Value(x);
		}
示例#19
0
 /// <remarks/>
 public void AddDomainWithProvisioningAsync(int packageId, string domainName, DomainType domainType, bool createWebSite, int pointWebSiteId, int pointMailDomainId, bool createDnsZone, bool createInstantAlias, bool allowSubDomains, string hostName) {
     this.AddDomainWithProvisioningAsync(packageId, domainName, domainType, createWebSite, pointWebSiteId, pointMailDomainId, createDnsZone, createInstantAlias, allowSubDomains, hostName, null);
 }
示例#20
0
 /// <remarks/>
 public System.IAsyncResult BeginAddDomainWithProvisioning(int packageId, string domainName, DomainType domainType, bool createWebSite, int pointWebSiteId, int pointMailDomainId, bool createDnsZone, bool createInstantAlias, bool allowSubDomains, string hostName, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("AddDomainWithProvisioning", new object[] {
                 packageId,
                 domainName,
                 domainType,
                 createWebSite,
                 pointWebSiteId,
                 pointMailDomainId,
                 createDnsZone,
                 createInstantAlias,
                 allowSubDomains,
                 hostName}, callback, asyncState);
 }
示例#21
0
 public int AddDomainWithProvisioning(int packageId, string domainName, DomainType domainType, bool createWebSite, int pointWebSiteId, int pointMailDomainId, bool createDnsZone, bool createInstantAlias, bool allowSubDomains, string hostName) {
     object[] results = this.Invoke("AddDomainWithProvisioning", new object[] {
                 packageId,
                 domainName,
                 domainType,
                 createWebSite,
                 pointWebSiteId,
                 pointMailDomainId,
                 createDnsZone,
                 createInstantAlias,
                 allowSubDomains,
                 hostName});
     return ((int)(results[0]));
 }