当前位置: 首页>>代码示例>>C#>>正文


C# Mapping类代码示例

本文整理汇总了C#中Mapping的典型用法代码示例。如果您正苦于以下问题:C# Mapping类的具体用法?C# Mapping怎么用?C# Mapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Mapping类属于命名空间,在下文中一共展示了Mapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Submit

        public void Submit(FBApi api, Mapping target)
        {
            Log.Verbose(LogCategory, "Submitting new or updated error information to server", null);

            // Start by looking for the fingerprint to decide whether we need
            // to create an new case or update an existing one.
            Dictionary<string, string> args = new Dictionary<string, string>
                           {
                               {"sScoutDescription", Error.Fingerprint},
                           };

            string results = api.Cmd("listScoutCase", args);
            XmlDocument xml = new XmlDocument();
            xml.LoadXml(results);
            XmlNode caseNode = xml.SelectSingleNode("/response/case/ixBug");

            if (caseNode == null)
            {
                Log.Information(LogCategory, "Submitting as new issue because no existing Scout Case could be found with the fingerprint", "Fingerprint: {0}\r\n\r\nRaw Result:\r\n{1}", Error.Fingerprint, results);
                SubmitNew(api, target);
            }
            else
            {
                Log.Information(LogCategory, "Submitting as an update because an existing Scout Case matched the fingerprint", "Fingerprint: {0}\r\n\r\nRaw Result:\r\n{1}", Error.Fingerprint, results);
                SubmitUpdate(api, caseNode.InnerText);
            }
        }
开发者ID:jwight1976,项目名称:Loupe.Samples,代码行数:27,代码来源:FogBugzCaseWriter.cs

示例2: PocoComponentTuplizer

		public PocoComponentTuplizer(Mapping.Component component) : base(component)
		{
			componentClass = component.ComponentClass;

			var parentProperty = component.ParentProperty;
			if (parentProperty == null)
			{
				parentSetter = null;
				parentGetter = null;
			}
			else
			{
				parentSetter = parentProperty.GetSetter(componentClass);
				parentGetter = parentProperty.GetGetter(componentClass);
			}

			if (hasCustomAccessors || !Cfg.Environment.UseReflectionOptimizer)
			{
				optimizer = null;
			}
			else
			{
				optimizer = Cfg.Environment.BytecodeProvider.GetReflectionOptimizer(componentClass, getters, setters);
			}
		}
开发者ID:kkozmic,项目名称:nhibernate,代码行数:25,代码来源:PocoComponentTuplizer.cs

示例3: Interface

        public Interface(Mapping.Interface iface, DataCenter[] dataCenters = null, IpAddress[] ips = null)
        {
            this.Id = iface.Id;
            this.DataCenterId = iface.DataCenterId;
            if (dataCenters != null)
                this.DataCenter = dataCenters.SingleOrDefault(d => d.Id == iface.DataCenterId);
            this.Created = iface.Created;
            this.LastUpdated = iface.LastUpdated;
            if (iface.Num != null)
                this.Index = Convert.ToInt32(iface.Num);
            this.Status = Converter.ToInterfaceStatus(iface.State);
            this.Bandwidth = iface.Bandwidth;
            this.Type = Converter.ToInterfaceType(iface.Type);
            if (iface.VirtualMachineId != null)
                this.VirtualMachineId = Convert.ToInt32(iface.VirtualMachineId);
            this.VirtualMachine = null;
            this.IpAddressIds = iface.IpAddressIds;
            if (ips != null)
            {
                List<IpAddress> ipList = new List<IpAddress>();
                foreach (int ipId in iface.IpAddressIds)
                {
                    IpAddress ipAddress = ips.SingleOrDefault(i => i.Id == ipId);

                    if (ipAddress.Interface == null)
                        ipAddress.Interface = this;

                    ipList.Add(ipAddress);
                }
                this.IpAddresses = ipList.ToArray();
            }
        }
开发者ID:nevasion,项目名称:gandi-desktop,代码行数:32,代码来源:Interface.cs

示例4: SqlMapperTransformer

        public SqlMapperTransformer(Mapping mapping, Evaluant.Uss.Models.Model model)
        {
            _Mapping = mapping;
            _Model = model;
            _ExprLevel = new Stack();

            _AliasColumnMapping = new Hashtable();
            _IsAliasColumnComputed = false;

            // Add "Type" and "Id" field. Avoid duplicated field if mapping model contains these two keyword fields.
            //            _AliasColumnMapping.Add("Type", "Type");

            foreach (EntityMapping em in mapping.Entities)
            {
                if (em.DiscriminatorField == null || em.DiscriminatorField == string.Empty)
                    continue;

                if (_AliasColumnMapping.ContainsKey(em.DiscriminatorField))
                    continue;

                _AliasColumnMapping.Add(em.DiscriminatorField, em.DiscriminatorField);
            }

            //_AliasColumnMapping.Add("Id", "Id");
        }
开发者ID:npenin,项目名称:uss,代码行数:25,代码来源:SqlMapperTransformer.cs

示例5: SqlMapperPersistenceEngine

        public SqlMapperPersistenceEngine(string connectionString, IDriver driver, DBDialect dialect, Mapping mapping, ArrayList cacheEntries, Models.Model model)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException("connectionString");
            }
            if (driver == null)
            {
                throw new ArgumentNullException("driver");
            }
            if (dialect == null)
            {
                throw new ArgumentNullException("dialect");
            }
            if (mapping == null)
            {
                throw new ArgumentNullException("mapping");
            }
            this.Driver = driver;
            this.Dialect = dialect;
            this._Mapping = mapping;
            this._Connection = this._Driver.CreateConnection(connectionString);

            if (_Connection is Evaluant.Uss.Data.FileClient.FileConnection)
            {
                ((Evaluant.Uss.Data.FileClient.FileConnection)_Connection).Dialect = dialect;
            }

            base._Model = model;
            this._CacheEntries = cacheEntries;
            this.Initialize();
        }
开发者ID:npenin,项目名称:uss,代码行数:32,代码来源:SqlMapperPersistenceEngine.cs

示例6: Init

		static void Init()
		{
			string[] wrk = "C,D,E,F,G,H,I,J,K,L,M,N,O.P,Q,R,S,T,U,V,W,X,Y,Z,C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1,N1,O.P1,Q1,R1,S1,T1,U1,V1,W1,X1,Y1,Z1,".Split(new char[] {','});
			mFS = new Mapping[wrk.Length];
			for (int i = 0; i < wrk.Length; i++) mFS[i] = new Mapping(wrk[i]);
			doneInit = true;
		}
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:FileSystem.cs

示例7: BuildTableScript

        protected override string BuildTableScript(Mapping.IEntityMapping mapping)
        {
            var tableName = GetTableName(mapping);
            var sb = new StringBuilder(512);
            sb.Append("CREATE TABLE ").Append(tableName).Append("(");

            int num = 0;
            foreach (var f in mapping.Members.Where(p => !p.IsRelationship && !p.IsComputed))
            {
                if (num > 0)
                    sb.Append(",");
                sb.AppendLine();

                sb.Append("\t").Append(Dialect.Quote(f.ColumnName));

                var sqlType = f.SqlType;
                sb.Append(" ").Append(GetDbType(f.SqlType));

                if (sqlType.Required || f.IsPrimaryKey)
                    sb.Append(" NOT NULL");

                if (f.IsGenerated)
                    sb.Append(GetDefaultValue(f, sqlType));
                num++;
            }

            sb.AppendLine()
                .Append(")");
            sb.AppendLine("");
            return sb.ToString();
        }
开发者ID:jaykizhou,项目名称:elinq,代码行数:31,代码来源:OracleScriptGenerator.cs

示例8: Add

        /// <summary>
        /// Add a specific resource.
        /// </summary>
        /// <param name="path">Path (Uri) requested by clients</param>
        /// <param name="assembly">Assembly that the resources exist in</param>
        /// <param name="rootNameSpace">Name space to root folder under (all name spaces below the specified one are considered as folders)</param>
        /// <param name="fullResourceName">Name space and name of resource.</param>
        /// <example>
        /// <code>
        /// Add("/", Assembly.GetExecutingAssembly(), "MyApplication.Files", "Myapplication.Files.Images.MyImage.png");
        /// </code>
        /// </example>
        public void Add(string path, Assembly assembly, string rootNameSpace, string fullResourceName)
        {
            if (!path.EndsWith("/"))
                path += "/";

            var mapping = new Mapping { Assembly = assembly, FullResourceName = fullResourceName };

            string filePath = fullResourceName.Remove(0, rootNameSpace.Length + 1);

            int extensionPos = filePath.LastIndexOf(".", StringComparison.Ordinal);
            if (extensionPos == -1)
                return;

            int nextPos = filePath.LastIndexOf(".", extensionPos - 1, StringComparison.Ordinal);
            if (nextPos != -1)
            {
                string typeExtension = filePath.Substring(nextPos + 1, extensionPos - nextPos - 1);
                if (typeExtension == "xml" || typeExtension == "json" || typeExtension == "js")
                    mapping.TypeExtension = typeExtension;
            }

            if (string.IsNullOrEmpty(mapping.TypeExtension))
                nextPos = extensionPos;

            // TODO: next thing is to set the language. But not today.
            // /users/list.1053.xml.spark <--- language 1053, view for xml, spark is the view engine.
            filePath = filePath.Substring(0, nextPos).Replace(".", "/") + filePath.Substring(extensionPos);

            mapping.FileName = Path.GetFileName(filePath).ToLower();
            mapping.UriPath = (path + filePath).Replace('\\', '/').ToLower();

            _logger.Trace("Adding mapping '" + path + filePath + "' to resource '" + fullResourceName + "' assembly '" + assembly + "'.");
            _mappings.Add(path.ToLower() + filePath.ToLower(), mapping);
        }
开发者ID:Horlos,项目名称:web-server,代码行数:46,代码来源:EmbededResourcesLoader.cs

示例9: Execute

        public bool Execute(string directory, Mapping mapToRun, BuildData buildData)
        {
            try
            {
                DeploymentHost host = new DeploymentHost();
                Runspace space = RunspaceFactory.CreateRunspace(host);
                space.Open();

                this.PopulateVariables(space, mapToRun, buildData);

                string command = this.GeneratePipelineCommand(directory, mapToRun);
                this._scriptRun = command;

                this.EnsureExecutionPolicy(space);
                Pipeline pipeline = space.CreatePipeline(command);
                Collection<PSObject> outputObjects = pipeline.Invoke();

                if (pipeline.PipelineStateInfo.State != PipelineState.Failed)
                {
                    this._errorOccured = false;
                }

                string output = this.GenerateOutputFromObjects(outputObjects);
                this._output = output;

                space.Close();
            }
            catch (Exception ex)
            {
                this._errorOccured = true;
                this._output = ex.ToString();
            }

            return this.ErrorOccured;
        }
开发者ID:hopenbr,项目名称:HopDev,代码行数:35,代码来源:PowerShellRunner.cs

示例10: mappings_can_be_added

 public void mappings_can_be_added()
 {
     var converter = new MapConverter();
     var mapping = new Mapping("from", "to");
     converter.Mappings.Add(mapping);
     Assert.True(converter.Mappings.Contains(mapping));
 }
开发者ID:davidlblake,项目名称:WPFConverters,代码行数:7,代码来源:MapConverterFixture.cs

示例11: AddMapping

        public DialogResult AddMapping(Dictionary<string, List<String>> productsAndApplications, 
            Dictionary<string, List<String>> projectsAndAreas, 
            Dictionary<int, string> priorities, 
            out Mapping newMapping)
        {
            Text = AddMappingTitle;

            m_ProductsAndApplications = productsAndApplications;
            m_ProjectsAndAreas = projectsAndAreas;
            m_Priorities = priorities;

            newMapping = null;

            DisplayProductsAndApplications();
            DisplayPriorities();
            DisplayProjectsAndAreas();

            DialogResult result = ShowDialog();
            if (result == DialogResult.OK)
            {
                newMapping = new Mapping();
                UpdateData(newMapping);
            }

            return result;
        }
开发者ID:jwight1976,项目名称:Loupe.Samples,代码行数:26,代码来源:NewMappingDialog.cs

示例12: OneToManyPersister

		public OneToManyPersister(Mapping.Collection collection, ICacheConcurrencyStrategy cache, Configuration cfg, ISessionFactoryImplementor factory)
			: base(collection, cache, cfg, factory)
		{
			_cascadeDeleteEnabled = collection.Key.IsCascadeDeleteEnabled && factory.Dialect.SupportsCascadeDelete;
			_keyIsNullable = collection.Key.IsNullable;
			_keyIsUpdateable = collection.Key.IsUpdateable;
		}
开发者ID:mrhihi,项目名称:nhibernate-core,代码行数:7,代码来源:OneToManyPersister.cs

示例13: EditMapping

        public DialogResult EditMapping(Dictionary<string, List<String>> productsAndApplications, 
            Dictionary<string, List<String>> projectsAndAreas,
            Dictionary<int, string> priorities,
            Mapping existingMapping)
        {
            Text = EditMappingTitle;

            m_ProductsAndApplications = productsAndApplications;
            m_ProjectsAndAreas = projectsAndAreas;
            m_Priorities = priorities;

            DisplayProductsAndApplications();
            DisplayPriorities();
            DisplayProjectsAndAreas();

            //display the current mapping values
            ProductSelection.Text = existingMapping.Product;
            ApplicationSelection.Text = existingMapping.Application;
            txtVersions.Text = existingMapping.Versions;

            ProjectSelection.SelectedItem = existingMapping.Project;
            AreaSelection.SelectedItem = existingMapping.Area;
            PrioritySelection.SelectedValue = existingMapping.Priority;

            DialogResult result = ShowDialog();
            if (result == DialogResult.OK)
            {
                UpdateData(existingMapping);
            }

            return result;
        }
开发者ID:jwight1976,项目名称:Loupe.Samples,代码行数:32,代码来源:NewMappingDialog.cs

示例14: BasicCollectionPersister

		public BasicCollectionPersister(
			Mapping.Collection collection,
			ICacheConcurrencyStrategy cache,
			ISessionFactoryImplementor factory)
			: base(collection, cache, factory)
		{
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:BasicCollectionPersister.cs

示例15: RegisterMapping

        public void RegisterMapping(ICompilerInputContract contract, ICompilerInputContractMapping dataRowContractMapping)
        {
            var properties = contract.Properties.Select(p => new CompilerInputContractProperty(p)).ToList();
            var fieldMappings = dataRowContractMapping.Mapping.ToList();

            var ixPropertyNames = new HashSet<string>(this.m_columnInfos.Select(c => c.ColumnName), StringComparer.OrdinalIgnoreCase);

            //if (fieldMappings.Count > properties.Count)
            //{
            //    m_compilerOutputBuilder.AddError(
            //        m_compilerNotificationMessageBuilder.TooFewTableTypeInterfaceMappingItems(m_fullName, contract.InterfaceName, properties.Count, fieldMappings.Count));
            //}

            var unexpectedColumnMappingNames = fieldMappings.Where(m => !(this.m_ixColumnNames.Contains(m.DataFieldName)));

            var mapping = new Mapping<DataColumnInfo, CompilerInputContractProperty>(
                dataRowContractMapping
                .Mapping
                .ToDictionary(m => m.DataFieldName, m => m.ContractPropertyName, StringComparer.Ordinal));

            var pairs = mapping.Map(this.m_columnInfos, properties);

            foreach (var pair in pairs)
            {
                this.m_interfaceMappings.Add(
                    new CompilerOutputInterfacePropertyMapping
                    {
                        InterfaceName = dataRowContractMapping.InterfaceName,
                        ColumnName = pair.Source.ColumnName,
                        PropertyName = pair.Target.PropertyName,
                        PropertyType = pair.Target.PropertyType
                    });
            }
        }
开发者ID:AlexeyEvlampiev,项目名称:Alenosoft,代码行数:34,代码来源:CompilerOutputTableTypeInfoBuilder.cs


注:本文中的Mapping类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。