Пример #1
0
		public MemberMapper[] GetMemberMappers()
		{
			var memberss = new MemberMapper[_parameters.Count];

			for (var i = 0; i < _parameters.Count; i++)
				memberss[i] = _parameters[i].MemberMapper;

			return memberss;
		}
Пример #2
0
		internal void SetMemberMapper(ObjectMapper objectMapper)
		{
			_memberMapper = objectMapper[_fieldName];
		}
Пример #3
0
			public ComplexMapper(MemberMapper memberMapper)
			{
				_mapper = memberMapper;
			}
        //NOTE Changed internal to public and added virtual
		public virtual void SetMemberMapper(ObjectMapper objectMapper)
		{
			_memberMapper = objectMapper[_fieldName];
		}
Пример #5
0
		protected internal virtual MemberMapper[] GetKeyFieldList(DbManager db, Type type)
		{
			var key    = type.FullName + "$" + db.DataProvider.UniqueName;
			_keyListLock.EnterReadLock();
			MemberMapper[] mmList = null;
			try
			{
				mmList = (MemberMapper[])_keyList[key];
			}
			finally 
			{
				_keyListLock.ExitReadLock();
			}
			if (mmList == null)
			{
				var typeExt = TypeExtension.GetTypeExtension(type, Extensions);
				var list    = new List<MemberOrder>();

				foreach (MemberMapper mm in db.MappingSchema.GetObjectMapper(type))
				{
					if (mm.MapMemberInfo.SqlIgnore)
						continue;

					var ma = mm.MapMemberInfo.MemberAccessor;

					if (TypeHelper.IsScalar(ma.Type))
					{
						bool isSet;
						var order = MappingSchema.MetadataProvider.GetPrimaryKeyOrder(type, typeExt, ma, out isSet);

						if (isSet)
							list.Add(new MemberOrder(mm, order));
					}
				}

				list.Sort((x, y) => x.Order - y.Order);

				_keyListLock.EnterWriteLock();
				try
				{
					_keyList[key] = mmList = new MemberMapper[list.Count];
					for (var i = 0; i < list.Count; i++)
						mmList[i] = list[i].MemberMapper;
				}
				finally
				{
					_keyListLock.ExitWriteLock();
				}
			}

			return mmList;
		}
Пример #6
0
			public MemberOrder(MemberMapper memberMapper, int order)
			{
				MemberMapper = memberMapper;
				Order        = order;
			}
Пример #7
0
		private static string GetDescription(MemberMapper mm)
		{
			var desc = mm.MemberAccessor.GetAttribute<DescriptionAttribute>();

			return (null != desc) ? desc.Description : string.Empty;
		}
Пример #8
0
		protected internal MemberMapper[] GetKeyFieldList(DbManager db, Type type)
		{
			string         key    = type.FullName + "$" + db.DataProvider.Name;
			MemberMapper[] mmList = (MemberMapper[])_keyList[key];

			if (mmList == null)
			{
				TypeExtension     typeExt = TypeExtension.GetTypeExtension(type, Extensions);
				List<MemberOrder> list    = new List<MemberOrder>();

				foreach (MemberMapper mm in db.MappingSchema.GetObjectMapper(type))
				{
					MemberAccessor ma = mm.MemberAccessor;

					if (TypeHelper.IsScalar(ma.Type))
					{
						bool isSet;
						int order = MappingSchema.MetadataProvider.GetPrimaryKeyOrder(type, typeExt, ma, out isSet);

						if (isSet)
							list.Add(new MemberOrder(mm, order));
					}
				}

				list.Sort(delegate(MemberOrder x, MemberOrder y) { return x.Order - y.Order; });

				_keyList[key] = mmList = new MemberMapper[list.Count];

				for (int i = 0; i < list.Count; i++)
					mmList[i] = list[i].MemberMapper;
			}

			return mmList;
		}