• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IMapping类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Validate

		public override void Validate(IMapping mapping)
		{
			base.Validate(mapping);
			if (Key != null && !Key.IsValid(mapping))
			{
				throw new MappingException(string.Format("subclass key has wrong number of columns: {0} type: {1}", MappedClass.Name, Key.Type.Name));
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:8,代码来源:JoinedSubclass.cs


示例17: GetIdsForBackTrack

		public IEnumerable<string> GetIdsForBackTrack(IMapping sessionFactory)
		{
			int paremeterSpan = keyType.GetColumnSpan(sessionFactory);
			for (int i = 0; i < paremeterSpan; i++)
			{
				yield return string.Format(CollectionFilterParameterIdTemplate, collectionRole, queryParameterPosition, i);
			}
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:8,代码来源:CollectionFilterKeyParameterSpecification.cs


示例18: FunctionStack

		public FunctionStack(IMapping mapping)
		{
			if (mapping == null)
			{
				throw new ArgumentNullException("mapping");
			}
			this.mapping = mapping;
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:8,代码来源:FunctionStack.cs


示例19: GetParemeterSpan

		protected int GetParemeterSpan(IMapping sessionFactory)
		{
			if (sessionFactory == null)
			{
				throw new ArgumentNullException("sessionFactory");
			}
			return ExpectedType.GetColumnSpan(sessionFactory);
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:8,代码来源:CriteriaNamedParameterSpecification.cs


示例20: HttpDataSource

        /// <summary>
        /// Initializes a new instance of the <see cref="HttpDataSource"/> type.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="mapping">The mapping.</param>
        public HttpDataSource(IContainer container, IMapping mapping)
            : base(container)
        {
            mapping = Enforce.NotNull(mapping, () => mapping);

            // Set the mapping.
            this.Mapping = mapping;
        }
开发者ID:peterbucher,项目名称:silkveil,代码行数:13,代码来源:HttpDataSource.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMappingEngine类代码示例发布时间:2022-05-24
下一篇:
C# IMapperConfiguration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap