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


C# MappingSchema类代码示例

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


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

示例1: InitGenericConvertProvider

		public bool InitGenericConvertProvider(Type[] types, MappingSchema mappingSchema)
		{
			var changed = false;

			if (_genericConvertProviders != null)
			{
				lock (_genericConvertProviders)
				{
					foreach (var type in _genericConvertProviders)
					{
						var args = type.Key.GetGenericArgumentsEx();

						if (args.Length == types.Length)
						{
							if (type.Value.Aggregate(false, (cur,ts) => cur || ts.SequenceEqual(types)))
								continue;

							var gtype    = type.Key.MakeGenericType(types);
							var provider = (IGenericInfoProvider)Activator.CreateInstance(gtype);

							provider.SetInfo(new MappingSchema(this));

							type.Value.Add(types);

							changed = true;
						}
					}
				}
			}

			return changed;
		}
开发者ID:ronnyek,项目名称:linq2db,代码行数:32,代码来源:MappingSchemaInfo.cs

示例2: SqlCeDataProvider

        protected SqlCeDataProvider(string name, MappingSchema mappingSchema)
            : base(name, mappingSchema)
        {
            SqlProviderFlags.IsSubQueryColumnSupported = false;

            SetCharField("NChar", (r,i) => r.GetString(i).TrimEnd());
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:7,代码来源:SqlCeDataProvider.cs

示例3: GetDataReader

		public override IDataReader GetDataReader(MappingSchema schema, IDataReader dataReader)
		{
			return
				dataReader is NpgsqlDataReader
					? new NpgsqlDataReaderEx(schema, (NpgsqlDataReader)dataReader)
					: base.GetDataReader(schema, dataReader);
		}
开发者ID:Firebie,项目名称:ItemsUsage,代码行数:7,代码来源:PostgreSQLDataProvider.cs

示例4: BaseSchema2

		public void BaseSchema2()
		{
			var ms1 = new MappingSchema();
			var ms2 = new MappingSchema(ms1);

			Convert<DateTime,string>.Lambda = d => d.ToString(DateTimeFormatInfo.InvariantInfo);

			ms1.SetConverter<DateTime,string>(d => d.ToString(new CultureInfo("en-US", false).DateTimeFormat));
			ms2.SetConverter<DateTime,string>(d => d.ToString(new CultureInfo("ru-RU", false).DateTimeFormat));

			{
				var c0 = Convert<DateTime,string>.Lambda;
				var c1 = ms1.GetConverter<DateTime,string>();
				var c2 = ms2.GetConverter<DateTime,string>();

				Assert.AreEqual("01/20/2012 16:30:40",  c0(new DateTime(2012, 1, 20, 16, 30, 40, 50, DateTimeKind.Utc)));
				Assert.AreEqual("1/20/2012 4:30:40 PM", c1(new DateTime(2012, 1, 20, 16, 30, 40, 50, DateTimeKind.Utc)));
				Assert.AreEqual("20.01.2012 16:30:40",  c2(new DateTime(2012, 1, 20, 16, 30, 40, 50, DateTimeKind.Utc)));
			}

			Convert<string,DateTime>.Expression = s => DateTime.Parse(s, DateTimeFormatInfo.InvariantInfo);

			ms1.SetConvertExpression<string,DateTime>(s => DateTime.Parse(s, new CultureInfo("en-US", false).DateTimeFormat));
			ms2.SetConvertExpression<string,DateTime>(s => DateTime.Parse(s, new CultureInfo("ru-RU", false).DateTimeFormat));

			{
				var c0 = Convert<string,DateTime>.Lambda;
				var c1 = ms1.GetConverter<string,DateTime>();
				var c2 = ms2.GetConverter<string,DateTime>();

				Assert.AreEqual(new DateTime(2012, 1, 20, 16, 30, 40), c0("01/20/2012 16:30:40"));
				Assert.AreEqual(new DateTime(2012, 1, 20, 16, 30, 40), c1("1/20/2012 4:30:40 PM"));
				Assert.AreEqual(new DateTime(2012, 1, 20, 16, 30, 40), c2("20.01.2012 16:30:40"));
			}
		}
开发者ID:jkshan,项目名称:linq2db,代码行数:35,代码来源:MappingSchemaTest.cs

示例5: OracleDataProvider

        protected OracleDataProvider(string name, MappingSchema mappingSchema)
            : base(name, mappingSchema)
        {
            SqlProviderFlags.MaxInListValuesCount = 1000;

            SetCharField("Char",  (r,i) => r.GetString(i).TrimEnd());
            SetCharField("NChar", (r,i) => r.GetString(i).TrimEnd());
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:8,代码来源:OracleDataProvider.cs

示例6: ServiceModelDataReader

		public ServiceModelDataReader(MappingSchema mappingSchema, LinqServiceResult result)
		{
			_mappingSchema = mappingSchema;
			_result        = result;

			for (var i = 0; i < result.FieldNames.Length; i++)
				_ordinal.Add(result.FieldNames[i], i);
		}
开发者ID:donners77,项目名称:linq2db,代码行数:8,代码来源:ServiceModelDataReader.cs

示例7: FullMappingSchema

 public FullMappingSchema(DbManager db, bool ignoreLazyLoad = false, MappingSchema parentMappingSchema = null, 
     FactoryType factoryType = FactoryType.LazyLoading)
 {
     _db = db;
     _parentMappingSchema = parentMappingSchema;
     _factoryType = factoryType;
     _ignoreLazyLoad = ignoreLazyLoad;
 }
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:8,代码来源:FullMappingSchema.cs

示例8: ScalarDataReaderMapper

		public ScalarDataReaderMapper(
			MappingSchema         mappingSchema,
			IDataReader           dataReader,
			NameOrIndexParameter  nameOrIndex)
			: base(mappingSchema, dataReader)
		{
			_index = nameOrIndex.ByName? dataReader.GetOrdinal(nameOrIndex.Name): nameOrIndex.Index;
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:8,代码来源:ScalarDataReaderMapper.cs

示例9: FirebirdDataProvider

        protected FirebirdDataProvider(string name, MappingSchema mappingSchema)
            : base(name, mappingSchema)
        {
            SetCharField("CHAR", (r,i) => r.GetString(i).TrimEnd());

            SetProviderField<IDataReader,TimeSpan,DateTime>((r,i) => r.GetDateTime(i) - new DateTime(1970, 1, 1));
            SetProviderField<IDataReader,DateTime,DateTime>((r,i) => GetDateTime(r, i));
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:8,代码来源:FirebirdDataProvider.cs

示例10: DB2DataProvider

        protected DB2DataProvider(string name, MappingSchema mappingSchema)
            : base(name, mappingSchema)
        {
            SqlProviderFlags.AcceptsTakeAsParameter       = false;
            SqlProviderFlags.AcceptsTakeAsParameterIfSkip = true;

            SetCharField("CHAR", (r,i) => r.GetString(i).TrimEnd());
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:8,代码来源:DB2DataProvider.cs

示例11: SetTable

			public override void SetTable(MappingSchema mappingSchema, SqlTable table, MemberInfo member, IEnumerable<Expression> arguments, IEnumerable<ISqlExpression> sqlArgs)
			{
				table.SqlTableType   = SqlTableType.Expression;
				table.Name           = Expression ?? member.Name;
				table.TableArguments = ConvertArgs(member, sqlArgs.ToArray());

				if (Schema   != null) table.Owner    = Schema;
				if (Database != null) table.Database = Database;
			}
开发者ID:donners77,项目名称:linq2db,代码行数:9,代码来源:Sql.TableExpressionAttribute.cs

示例12: ObjToDicTest

		//[Test]
		public void ObjToDicTest()
		{
			var obj  = new TestObj { Country = CountryCodeEnum1.DZ, Other = OtherEnum1.EnumValue2 };
			var sh   = new MappingSchema { Extensions = TypeExtension.GetExtensions("Map.xml") };
			var pars = sh.MapObjectToDictionary(obj);

			Assert.AreEqual("DZ", pars["country_code"]);
			Assert.AreEqual(101,  pars["other"]);
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:10,代码来源:EnumExtension.cs

示例13: SQLiteDataProvider

        protected SQLiteDataProvider(string name, MappingSchema mappingSchema)
            : base(name, mappingSchema)
        {
            SqlProviderFlags.IsSkipSupported       = false;
            SqlProviderFlags.IsSkipSupportedIfTake = true;

            SetCharField("char",  (r,i) => r.GetString(i).TrimEnd());
            SetCharField("nchar", (r,i) => r.GetString(i).TrimEnd());
        }
开发者ID:jogibear9988,项目名称:linq2db,代码行数:9,代码来源:SQLiteDataProvider.cs

示例14: PostgreSQLDataProvider

        protected PostgreSQLDataProvider(string name, MappingSchema mappingSchema)
            : base(name, mappingSchema)
        {
            SqlProviderFlags.IsInsertOrUpdateSupported = false;

            SetCharField("bpchar", (r,i) => r.GetString(i).TrimEnd());

            _sqlOptimizer = new PostgreSQLSqlOptimizer(SqlProviderFlags);
        }
开发者ID:nectide,项目名称:linq2db,代码行数:9,代码来源:PostgreSQLDataProvider.cs

示例15: DefaultValue1

		public void DefaultValue1()
		{
			var ms = new MappingSchema();

			ms.SetDefaultValue(typeof(int), -1);

			var c = ms.GetConverter<int?,int>();

			Assert.AreEqual(-1, c(null));
		}
开发者ID:jkshan,项目名称:linq2db,代码行数:10,代码来源:MappingSchemaTest.cs


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