public JoinDescriptor AddJoinDescriptor(int docType, Type type, params object[] data) { if (type == null) { throw new ArgumentNullException("type"); } if (data.Length == 0) { throw new ArgumentException("Must have at least one property info", "data"); } if (0 != data.Length % 2) { throw new ArgumentException("Invalid data array length: " + data.Length, "data"); } if (m_fieldsMap == null) { throw new InvalidOperationException("Cannot invoke AddJoinDescriptor before BeginDefineDocumentTypes"); } if (m_descriptor == null) { throw new InvalidOperationException("Cannot invoke AddJoinDescriptor after Commit was called"); } var docTypeDescriptor = m_descriptor.RequireDocumentType(docType); var joinPropertyNameToDocumentType = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase); for (var i = 0; i < data.Length; i += 2) { try { var propName = data[i] as string; if (string.IsNullOrEmpty(propName)) { throw new ArgumentException("Empty property name in the data array, element " + i); } var propDocType = (int)data[i + 1]; if (null == m_descriptor.TryGetDocTypeName(propDocType)) { throw new ArgumentException("Unknown document type " + propDocType + " for property " + propName); } joinPropertyNameToDocumentType.Add(propName, propDocType); } catch (Exception e) { throw new ArgumentException("Failed to parse property infos: " + e.Message, "data", e); } } var result = new JoinDescriptor(docTypeDescriptor.DocumentType, type, joinPropertyNameToDocumentType); m_descriptor.AddJoinDescriptor(result); return(result); }
public void AddJoinDescriptor(JoinDescriptor joinType) { if (joinType == null) { throw new ArgumentNullException("joinType"); } JoinDescriptors.Add(joinType.DocumentType, joinType); }
public void AddJoinDescriptor(JoinDescriptor joinType) { if (joinType == null) { throw new ArgumentNullException("joinType"); } JoinDescriptors.Add(joinType.DocumentType, joinType); }
public JoinDescriptor AddJoinDescriptor(int docType, Type type, params object[] data) { if (type == null) { throw new ArgumentNullException("type"); } if (data.Length == 0) { throw new ArgumentException("Must have at least one property info", "data"); } if (0 != data.Length % 2) { throw new ArgumentException("Invalid data array length: " + data.Length, "data"); } if (m_fieldsMap == null) { throw new InvalidOperationException("Cannot invoke AddJoinDescriptor before BeginDefineDocumentTypes"); } if (m_descriptor == null) { throw new InvalidOperationException("Cannot invoke AddJoinDescriptor after Commit was called"); } var docTypeDescriptor = m_descriptor.RequireDocumentType(docType); var joinPropertyNameToDocumentType = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); for (var i = 0; i < data.Length; i += 2) { try { var propName = data[i] as string; if (string.IsNullOrEmpty(propName)) { throw new ArgumentException("Empty property name in the data array, element " + i); } var propDocType = (int) data[i + 1]; if (null == m_descriptor.TryGetDocTypeName(propDocType)) { throw new ArgumentException("Unknown document type " + propDocType + " for property " + propName); } joinPropertyNameToDocumentType.Add(propName, propDocType); } catch (Exception e) { throw new ArgumentException("Failed to parse property infos: " + e.Message, "data", e); } } var result = new JoinDescriptor(docTypeDescriptor.DocumentType, type, joinPropertyNameToDocumentType); m_descriptor.AddJoinDescriptor(result); return result; }