Exemplo n.º 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;
		}
Exemplo n.º 2
0
		internal void SetMemberMapper(ObjectMapper objectMapper)
		{
			_memberMapper = objectMapper[_fieldName];
		}
Exemplo n.º 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];
		}
Exemplo n.º 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;
		}
Exemplo n.º 6
0
			public MemberOrder(MemberMapper memberMapper, int order)
			{
				MemberMapper = memberMapper;
				Order        = order;
			}
Exemplo n.º 7
0
		private static string GetDescription(MemberMapper mm)
		{
			var desc = mm.MemberAccessor.GetAttribute<DescriptionAttribute>();

			return (null != desc) ? desc.Description : string.Empty;
		}
Exemplo n.º 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;
		}