public XmlDataTypeStore(DataTypeDescriptor dataTypeDescriptor, Type dataProviderHelperType, Type dataIdClassType, IEnumerable<XmlDataTypeStoreDataScope> xmlDateTypeStoreDataScopes, bool isGeneratedDataType)
{
if (dataProviderHelperType == null) throw new ArgumentNullException("dataProviderHelperType");
if (dataIdClassType == null) throw new ArgumentNullException("dataIdClassType");
DataTypeDescriptor = dataTypeDescriptor;
DataProviderHelperType = dataProviderHelperType;
DataIdClassType = dataIdClassType;
IsGeneratedDataType = isGeneratedDataType;
_xmlDateTypeStoreDataScopes = xmlDateTypeStoreDataScopes.Evaluate();
var ordering = new List<Func<XElement, IComparable>>();
foreach (string key in dataTypeDescriptor.KeyPropertyNames)
{
XName localKey = key;
ordering.Add(f => (string)f.Attribute(localKey) ?? "");
}
Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>> orderer = f => ordering.Skip(1).Aggregate(f.OrderBy(ordering.First()), Enumerable.ThenBy);
foreach (XmlDataTypeStoreDataScope xmlDataTypeStoreDataScope in _xmlDateTypeStoreDataScopes)
{
DataScopeIdentifier dataScopeIdentifier = DataScopeIdentifier.Deserialize(xmlDataTypeStoreDataScope.DataScopeName);
CultureInfo culture = CultureInfo.CreateSpecificCulture(xmlDataTypeStoreDataScope.CultureName);
Type dataType = dataTypeDescriptor.GetInterfaceType();
Action cacheFlush = () => DataEventSystemFacade.FireExternalStoreChangedEvent(dataType, dataScopeIdentifier.ToPublicationScope(), culture);
XmlDataProviderDocumentCache.RegisterExternalFileChangeAction(xmlDataTypeStoreDataScope.Filename, cacheFlush);
XmlDataProviderDocumentWriter.RegisterFileOrderer(xmlDataTypeStoreDataScope.Filename, orderer);
}
}