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


C# IMapping类代码示例

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


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

示例1: DemoService

 public DemoService(IRepository<DemoEntity> demoRepository,
     IEventPublisher eventPublisher,IMapping mapping)
 {
     _demoRepository = demoRepository;
     _eventPublisher = eventPublisher;
     _mapping = mapping;
 }
开发者ID:TelWang,项目名称:WatermoonFramework,代码行数:7,代码来源:DemoService.cs

示例2: SqlTypes

		public override SqlType[] SqlTypes(IMapping mapping)
		{
			if (compression == null)
				return new SqlType[] { new StringClobSqlType() };
			else
				return new SqlType[] { new BinaryBlobSqlType() };
		}
开发者ID:sebmarkbage,项目名称:calyptus.lob,代码行数:7,代码来源:XlobType.cs

示例3: GetAliasedLHSColumnNames

 /// <summary>
 /// Get the aliased columns of the owning entity which are to 
 /// be used in the join
 /// </summary>
 public static string[] GetAliasedLHSColumnNames(
     IAssociationType type,
     string alias,
     int property,
     int begin,
     IOuterJoinLoadable lhsPersister,
     IMapping mapping
     )
 {
     if (type.UseLHSPrimaryKey)
     {
         return StringHelper.Qualify(alias, lhsPersister.IdentifierColumnNames);
     }
     else
     {
         string propertyName = type.LHSPropertyName;
         if (propertyName == null)
         {
             return ArrayHelper.Slice(
                 lhsPersister.ToColumns(alias, property),
                 begin,
                 type.GetColumnSpan(mapping)
                 );
         }
         else
         {
             return ((IPropertyMapping) lhsPersister).ToColumns(alias, propertyName); //bad cast
         }
     }
 }
开发者ID:zibler,项目名称:zibler,代码行数:34,代码来源:JoinHelper.cs

示例4: Read

        /// <summary>Read in rating data from a TextReader</summary>
        /// <param name="reader">the <see cref="TextReader"/> to read from</param>
        /// <param name="user_mapping">mapping object for user IDs</param>
        /// <param name="item_mapping">mapping object for item IDs</param>
        /// <returns>the rating data</returns>
        public static ITimedRatings Read(TextReader reader, IMapping user_mapping = null, IMapping item_mapping = null)
        {
            if (user_mapping == null)
                user_mapping = new IdentityMapping();
            if (item_mapping == null)
                item_mapping = new IdentityMapping();

            var ratings = new TimedRatings();

            string[] separators = { "::" };
            string line;

            while ((line = reader.ReadLine()) != null)
            {
                string[] tokens = line.Split(separators, StringSplitOptions.None);

                if (tokens.Length < 4)
                    throw new FormatException(string.Format("Expected at least 4 columns: {0}", line));

                int user_id = user_mapping.ToInternalID(tokens[0]);
                int item_id = item_mapping.ToInternalID(tokens[1]);
                float rating = float.Parse(tokens[2], CultureInfo.InvariantCulture);
                long seconds = uint.Parse(tokens[3]);

                var time = new DateTime(seconds * 10000000L).AddYears(1969);
                var offset = TimeZone.CurrentTimeZone.GetUtcOffset(time);
                time -= offset;

                ratings.Add(user_id, item_id, rating, time);
            }
            return ratings;
        }
开发者ID:pipifuyj,项目名称:MyMediaLite,代码行数:37,代码来源:MovieLensRatingData.cs

示例5: SqlTriggerBody

        public override string SqlTriggerBody(
      Dialect dialect, IMapping p, 
      string defaultCatalog, string defaultSchema)
        {
            var auditTableName = dialect.QuoteForTableName(_auditTableName);
              var eDialect = (IExtendedDialect)dialect;

              string triggerSource = _action == TriggerActions.DELETE ?
            eDialect.GetTriggerOldDataAlias() :
            eDialect.GetTriggerNewDataAlias();

              var columns = new List<string>(_dataColumnNames);
              columns.AddRange(from ac in _auditColumns
                       select ac.Name);

              var values = new List<string>();
              values.AddRange(
            from columnName in _dataColumnNames
            select eDialect.QualifyColumn(
              triggerSource, columnName));
              values.AddRange(
            from auditColumn in _auditColumns
            select auditColumn.ValueFunction.Invoke(_action));

              return eDialect.GetInsertIntoString(auditTableName,
            columns, triggerSource, values);
        }
开发者ID:akhuang,项目名称:NHibernate,代码行数:27,代码来源:AuditTrigger.cs

示例6: Read

		/// <summary>Read binary attribute data from a file</summary>
		/// <remarks>
		/// The expected (sparse) line format is:
		/// ENTITY_ID tab/space/comma ATTRIBUTE_ID
		/// for the relations that hold.
		/// </remarks>
		/// <param name="filename">the name of the file to be read from</param>
		/// <param name="mapping">the mapping object for the given entity type</param>
		/// <returns>the attribute data</returns>
		static public IBooleanMatrix Read(string filename, IMapping mapping)
		{
			return Wrap.FormatException<IBooleanMatrix>(filename, delegate() {
				using ( var reader = new StreamReader(filename) )
					return Read(reader, mapping);
			});
		}
开发者ID:WisonHuang,项目名称:MyMediaLite,代码行数:16,代码来源:AttributeData.cs

示例7: CompositeElementPropertyMapping

		public CompositeElementPropertyMapping(string[] elementColumns, string[] elementFormulaTemplates,
																					 IAbstractComponentType compositeType, IMapping factory)
		{
			this.compositeType = compositeType;

			InitComponentPropertyPaths(null, compositeType, elementColumns, elementFormulaTemplates, factory);
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:CompositeElementPropertyMapping.cs

示例8: Read

        /// <summary>Read in rating data from a TextReader</summary>
        /// <param name="reader">the <see cref="TextReader"/> to read from</param>
        /// <param name="user_mapping">mapping object for user IDs</param>
        /// <param name="item_mapping">mapping object for item IDs</param>
        /// <param name="ignore_first_line">if true, ignore the first line</param>
        /// <returns>the rating data</returns>
        public static IRatings Read(TextReader reader, IMapping user_mapping = null, IMapping item_mapping = null, bool ignore_first_line = false)
        {
            if (user_mapping == null)
                user_mapping = new IdentityMapping();
            if (item_mapping == null)
                item_mapping = new IdentityMapping();
            if (ignore_first_line)
                reader.ReadLine();

            var ratings = new Ratings();

            string line;
            while ( (line = reader.ReadLine()) != null )
            {
                if (line.Length == 0)
                    continue;

                string[] tokens = line.Split(Constants.SPLIT_CHARS);

                if (tokens.Length < 3)
                    throw new FormatException("Expected at least 3 columns: " + line);

                int user_id = user_mapping.ToInternalID(tokens[0]);
                int item_id = item_mapping.ToInternalID(tokens[1]);
                float rating = float.Parse(tokens[2], CultureInfo.InvariantCulture);

                ratings.Add(user_id, item_id, rating);
            }
            ratings.InitScale();
            return ratings;
        }
开发者ID:pipifuyj,项目名称:MyMediaLite,代码行数:37,代码来源:RatingData.cs

示例9: SqlCreateString

 public override string SqlCreateString(Dialect dialect,
     IMapping p, string defaultCatalog, string defaultSchema)
 {
     FinalizeAuditTable((IExtendedDialect) dialect);
       return auditTable.SqlCreateString(
     dialect, p, defaultCatalog, defaultSchema);
 }
开发者ID:michelelepri,项目名称:uNhAddIns,代码行数:7,代码来源:AuditTable.cs

示例10: Read

		/// <summary>Read in rating data which will be interpreted as implicit feedback data from a TextReader</summary>
		/// <param name="reader">the TextReader to be read from</param>
		/// <param name="rating_threshold">the minimum rating value needed to be accepted as positive feedback</param>
		/// <param name="user_mapping">user <see cref="IMapping"/> object</param>
		/// <param name="item_mapping">item <see cref="IMapping"/> object</param>
		/// <param name="ignore_first_line">if true, ignore the first line</param>
		/// <returns>a <see cref="IPosOnlyFeedback"/> object with the user-wise collaborative data</returns>
		static public IPosOnlyFeedback Read(TextReader reader, float rating_threshold, IMapping user_mapping = null, IMapping item_mapping = null, bool ignore_first_line = false)
		{
			if (user_mapping == null)
				user_mapping = new IdentityMapping();
			if (item_mapping == null)
				item_mapping = new IdentityMapping();
			if (ignore_first_line)
				reader.ReadLine();

			var feedback = new PosOnlyFeedback<SparseBooleanMatrix>();

			string line;
			while ((line = reader.ReadLine()) != null)
			{
				if (line.Trim().Length == 0)
					continue;

				string[] tokens = line.Split(Constants.SPLIT_CHARS);

				if (tokens.Length < 3)
					throw new FormatException("Expected at least 3 columns: " + line);

				int user_id   = user_mapping.ToInternalID(tokens[0]);
				int item_id   = item_mapping.ToInternalID(tokens[1]);
				float rating  = float.Parse(tokens[2], CultureInfo.InvariantCulture);

				if (rating >= rating_threshold)
					feedback.Add(user_id, item_id);
			}

			return feedback;
		}
开发者ID:WisonHuang,项目名称:MyMediaLite,代码行数:39,代码来源:ItemDataRatingThreshold.cs

示例11: Register

        internal void Register(IMapping mapping)
        {
            if (!_mappings.ContainsKey(mapping.InterfaceType))
                _mappings[mapping.InterfaceType] = new Collection<IMapping>();

            _mappings[mapping.InterfaceType].Add(mapping);
        }
开发者ID:dhoare12,项目名称:machine.fakes,代码行数:7,代码来源:MappingRegistry.cs

示例12: Read

        /// <summary>Read in static rating data from a file</summary>
        /// <param name="filename">the name of the file to read from</param>
        /// <param name="user_mapping">mapping object for user IDs</param>
        /// <param name="item_mapping">mapping object for item IDs</param>
        /// <param name="rating_type">the data type to be used for storing the ratings</param>
        /// <param name="ignore_first_line">if true, ignore the first line</param>
        /// <returns>the rating data</returns>
        public static IRatings Read(
			string filename,
			IMapping user_mapping = null, IMapping item_mapping = null,
			RatingType rating_type = RatingType.FLOAT,
			bool ignore_first_line = false)
        {
            string binary_filename = filename + ".bin.StaticRatings";
            if (FileSerializer.Should(user_mapping, item_mapping) && File.Exists(binary_filename))
                return (IRatings) FileSerializer.Deserialize(binary_filename);

            int size = 0;
            using ( var reader = new StreamReader(filename) )
                while (reader.ReadLine() != null)
                    size++;
            if (ignore_first_line)
                size--;

            return Wrap.FormatException<IRatings>(filename, delegate() {
                using ( var reader = new StreamReader(filename) )
                {
                    var ratings = (StaticRatings) Read(reader, size, user_mapping, item_mapping, rating_type);
                    if (FileSerializer.Should(user_mapping, item_mapping) && FileSerializer.CanWrite(binary_filename))
                        ratings.Serialize(binary_filename);
                    return ratings;
                }
            });
        }
开发者ID:wendelad,项目名称:RecSys,代码行数:34,代码来源:StaticRatingData.cs

示例13: Create

		/// <summary>
		/// Creates a specific Persister - could be a built in or custom persister.
		/// </summary>
		public static IEntityPersister Create(System.Type persisterClass, PersistentClass model,
		                                      ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory,
		                                      IMapping cfg)
		{
			ConstructorInfo pc;
			try
			{
				pc = persisterClass.GetConstructor(PersisterConstructorArgs);
			}
			catch (Exception e)
			{
				throw new MappingException("Could not get constructor for " + persisterClass.Name, e);
			}

			try
			{
				return (IEntityPersister) pc.Invoke(new object[] {model, cache, factory, cfg});
			}
			catch (TargetInvocationException tie)
			{
				Exception e = tie.InnerException;
				if (e is HibernateException)
				{
					throw e;
				}
				else
				{
					throw new MappingException("Could not instantiate persister " + persisterClass.Name, e);
				}
			}
			catch (Exception e)
			{
				throw new MappingException("Could not instantiate persister " + persisterClass.Name, e);
			}
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:38,代码来源:PersisterFactory.cs

示例14: ReturnType

		public override IType ReturnType(IType columnType, IMapping mapping)
		{
			if (columnType == null)
			{
				throw new ArgumentNullException("columnType");
			}
			SqlType[] sqlTypes;
			try
			{
				sqlTypes = columnType.SqlTypes(mapping);
			}
			catch (MappingException me)
			{
				throw new QueryException(me);
			}

			if (sqlTypes.Length != 1)
			{
				throw new QueryException("multi-column type can not be in avg()");
			}

			SqlType sqlType = sqlTypes[0];

			if (sqlType.DbType == DbType.Int16 || sqlType.DbType == DbType.Int32 || sqlType.DbType == DbType.Int64)
			{
				return NHibernateUtil.Single;
			}
			else
			{
				return columnType;
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:32,代码来源:ClassicAvgFunction.cs

示例15: SqlCreateString

		public override string SqlCreateString(
			Dialect.Dialect dialect,
			IMapping p,
			string defaultSchema)
		{
			return InjectCatalogAndSchema(sqlCreateString, defaultSchema);
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:SimpleAuxiliaryDatabaseObject.cs


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