public MapRelationBase( Type slave, MapIndex slaveIndex, MapIndex masterIndex, string containerName) { if (slave == null) throw new ArgumentNullException("slave"); if (masterIndex.Fields.Length == 0) throw new MappingException("Master index length can not be 0."); if ( slaveIndex.Fields.Length == 0) throw new MappingException("Slave index length can not be 0."); if (masterIndex.Fields.Length != slaveIndex.Fields.Length) throw new MappingException("Master and slave indexes do not match."); if (string.IsNullOrEmpty(containerName)) throw new MappingException("Master container field name is wrong."); _slave = slave; _masterIndex = masterIndex; _slaveIndex = slaveIndex; _containerName = containerName; }
public static Dictionary <CompoundValue, T> DictionaryToDictionary <T>( IDictionary sourceDictionary, MapIndex index, params object[] parameters) { return(_defaultSchema.MapDictionaryToDictionary <T>(sourceDictionary, index, parameters)); }
public static Dictionary <CompoundValue, T> DataTableToDictionary <T>( DataTable sourceTable, MapIndex index, params object[] parameters) { return(_defaultSchema.MapDataTableToDictionary <T>(sourceTable, index, parameters)); }
public static Dictionary <CompoundValue, T> DataReaderToDictionary <T>( IDataReader dataReader, MapIndex index, params object[] parameters) { return(_defaultSchema.MapDataReaderToDictionary <T>(dataReader, index, parameters)); }
public static Dictionary <CompoundValue, T> ListToDictionary <T>( ICollection sourceList, MapIndex index, params object[] parameters) { return(_defaultSchema.MapListToDictionary <T>(sourceList, index, parameters)); }
public static IDictionary DictionaryToDictionary( IDictionary sourceDictionary, MapIndex index, Type destObjectType, params object[] parameters) { return(_defaultSchema.MapDictionaryToDictionary(sourceDictionary, index, destObjectType, parameters)); }
public static IDictionary DataReaderToDictionary( IDataReader dataReader, MapIndex index, Type destObjectType, params object[] parameters) { return(_defaultSchema.MapDataReaderToDictionary(dataReader, index, destObjectType, parameters)); }
public static IDictionary ListToDictionary( ICollection sourceList, MapIndex index, Type destObjectType, params object[] parameters) { return(_defaultSchema.MapListToDictionary(sourceList, index, destObjectType, parameters)); }
public static Hashtable DataTableToDictionary( DataTable sourceTable, MapIndex index, Type destObjectType, params object[] parameters) { return(_defaultSchema.MapDataTableToDictionary(sourceTable, index, destObjectType, parameters)); }
public MapRelation( MapResultSet slaveResultSet, MapIndex slaveIndex, MapIndex masterIndex, string containerName) : base(slaveResultSet.ObjectType, slaveIndex, masterIndex, containerName) { _slaveResultSet = slaveResultSet; }
public MapRelation( MapResultSet slaveResultSet, MapIndex slaveIndex, MapIndex masterIndex, string containerName) : base(slaveResultSet.ObjectType, slaveIndex, masterIndex, containerName) { _slaveResultSet = slaveResultSet; }
public void AddRelation( MapResultSet slaveResultSet, MapIndex slaveIndex, MapIndex masterIndex, string containerName) { if (_relationList == null) _relationList = new List<MapRelation>(); _relationList.Add(new MapRelation(slaveResultSet, slaveIndex, masterIndex, containerName)); }
public MapNextResult( Type type, MapIndex slaveIndex, MapIndex masterIndex, string containerName, params MapNextResult[] nextResults) { _objectType = type; _slaveIndex = slaveIndex; _masterIndex = masterIndex; _containerName = containerName; _nextResults = nextResults; }
public void AddRelation( MapResultSet slaveResultSet, MapIndex slaveIndex, MapIndex masterIndex, string containerName) { if (_relationList == null) { _relationList = new List <MapRelation>(); } _relationList.Add(new MapRelation(slaveResultSet, slaveIndex, masterIndex, containerName)); }
public MapNextResult( Type type, MapIndex slaveIndex, MapIndex masterIndex, string containerName, params MapNextResult[] nextResults) { _objectType = type; _slaveIndex = slaveIndex; _masterIndex = masterIndex; _containerName = containerName; _nextResults = nextResults; }
public DictionaryIndexListMapper( IDictionary dic, MapIndex index, ObjectMapper objectMapper) { _dic = dic; _mapper = objectMapper; _fields = new NameOrIndexParameter[index.Fields.Length]; _fromSource = new bool[index.Fields.Length]; for (int i = 0; i < _fields.Length; i++) { bool fromSource = index.Fields[i].ByName && index.Fields[i].Name[0] == '@'; _fields[i] = fromSource? index.Fields[i].Name.Substring(1): index.Fields[i]; _fromSource[i] = fromSource; _isFromSource = _isFromSource || fromSource; _isFromDest = _isFromDest || !fromSource; } }
public DictionaryIndexListMapper( IDictionary dic, MapIndex index, ObjectMapper objectMapper) { _dic = dic; _mapper = objectMapper; _fields = new NameOrIndexParameter[index.Fields.Length]; _fromSource = new bool[index.Fields.Length]; for (int i = 0; i < _fields.Length; i++) { bool fromSource = index.Fields[i].ByName && index.Fields[i].Name[0] == '@'; _fields[i] = fromSource? index.Fields[i].Name.Substring(1): index.Fields[i]; _fromSource[i] = fromSource; _isFromSource = _isFromSource || fromSource; _isFromDest = _isFromDest || !fromSource; } }
public MapRelationBase( Type slave, MapIndex slaveIndex, MapIndex masterIndex, string containerName) { if (slave == null) { throw new ArgumentNullException("slave"); } if (masterIndex.Fields.Length == 0) { throw new MappingException("Master index length can not be 0."); } if (slaveIndex.Fields.Length == 0) { throw new MappingException("Slave index length can not be 0."); } if (masterIndex.Fields.Length != slaveIndex.Fields.Length) { throw new MappingException("Master and slave indexes do not match."); } if (string.IsNullOrEmpty(containerName)) { throw new MappingException("Master container field name is wrong."); } _slave = slave; _masterIndex = masterIndex; _slaveIndex = slaveIndex; _containerName = containerName; }
public Hashtable GetIndex(MappingSchema ms, MapIndex masterIndex) { string indexId = masterIndex.ID; Hashtable indexHash = null; if (_indexies.TryGetValue(indexId, out indexHash)) { return(indexHash); } ObjectMapper masterMapper = ms.GetObjectMapper(ObjectType); List <MapIndex> createIndex = new List <MapIndex>(); indexHash = new Hashtable(); foreach (object o in List) { object key = masterIndex.GetValueOrIndex(masterMapper, o); if (ms.IsNull(key)) { continue; } ArrayList matches = (ArrayList)indexHash[key]; if (matches == null) { indexHash[key] = matches = new ArrayList(); } matches.Add(o); } return(indexHash); }
public IDictionary <object, IList> GetIndex(MappingSchema ms, MapIndex masterIndex) { var indexId = masterIndex.ID; IDictionary <object, IList> indexHash; if (_indexies.TryGetValue(indexId, out indexHash)) { return(indexHash); } var masterMapper = ms.GetObjectMapper(ObjectType); indexHash = new Dictionary <object, IList>(); foreach (var o in List) { var key = masterIndex.GetValueOrIndex(masterMapper, o); if (ms.IsNull(key)) { continue; } IList matches; if (!indexHash.TryGetValue(key, out matches)) { indexHash.Add(key, matches = new List <object>()); } matches.Add(o); } return(indexHash); }
public IDictionary<object,IList> GetIndex(MappingSchema ms, MapIndex masterIndex) { var indexId = masterIndex.ID; IDictionary<object,IList> indexHash; if (_indexies.TryGetValue(indexId, out indexHash)) return indexHash; var masterMapper = ms.GetObjectMapper(ObjectType); indexHash = new Dictionary<object, IList>(); foreach (var o in List) { var key = masterIndex.GetValueOrIndex(masterMapper, o); if (ms.IsNull(key)) continue; IList matches; if (!indexHash.TryGetValue(key, out matches)) indexHash.Add(key, matches = new List<object>()); matches.Add(o); } return indexHash; }