private CollectionMapping BuildCollectionMapping(ICollectionMappingProvider provider)
        {
            var collectionMapping = new CollectionMapping(
                provider.PropertyInfo.DeclaringType,
                provider.PropertyInfo.PropertyType,
                provider.PropertyInfo.Name,
                provider.GetTerm(_mappingContext.OntologyProvider),
                provider.StoreAs);
            bool converterSet = SetConverter(collectionMapping, provider);
            if ((provider.ElementConverterType != null) && (!provider.ElementConverterType.ContainsGenericParameters))
            {
                collectionMapping.ElementConverter = (INodeConverter)Activator.CreateInstance(provider.ElementConverterType);
            }
            else if (converterSet)
            {
                collectionMapping.ElementConverter = collectionMapping.Converter;
            }

            return collectionMapping;
        }
Exemplo n.º 2
0
        private CollectionMapping BuildCollectionMapping(ICollectionMappingProvider provider)
        {
            var collectionMapping = new CollectionMapping(
                provider.PropertyInfo.DeclaringType,
                provider.PropertyInfo.PropertyType,
                provider.PropertyInfo.Name,
                provider.GetTerm(_mappingContext.OntologyProvider),
                provider.StoreAs);
            bool converterSet = SetConverter(collectionMapping, provider);

            if ((provider.ElementConverterType != null) && (!provider.ElementConverterType.GetTypeInfo().ContainsGenericParameters))
            {
                collectionMapping.ElementConverter = _converterCatalog.GetConverter(provider.ElementConverterType);
            }
            else if (converterSet)
            {
                collectionMapping.ElementConverter = collectionMapping.Converter;
            }

            return(collectionMapping);
        }