Example #1
0
        private CollectionAttribute AttributeMadeFrom <TConverter>(string iriOrTerm, string prefix = null, string graph = null, string graphPrefix = null)
        {
            CollectionAttribute result;

            if (prefix == null)
            {
                result = new CollectionAttribute()
                {
                    Iri = iriOrTerm, Graph = graph
                };
            }
            else
            {
                result = (graphPrefix == null ? new CollectionAttribute(prefix, iriOrTerm)
                {
                    Graph = graph
                } : new CollectionAttribute(prefix, iriOrTerm, graphPrefix, graph));
            }

            result.ValueConverterType = typeof(TConverter);
            result.StoreAs            = CollectionStorageModel.Simple;
            return(result);
        }
        internal static AttributeCollectionMappingProvider FromAttribute(Type type, PropertyInfo property, CollectionAttribute collectionMapping)
        {
            var types = new List <Type>()
            {
                typeof(Type), typeof(PropertyInfo)
            };
            var parameters = new List <object>()
            {
                type, property
            };

            AddTerm(types, parameters, collectionMapping.MappedIri, collectionMapping.Prefix, collectionMapping.Term);
            types.Add(typeof(CollectionStorageModel));
            parameters.Add(collectionMapping.StoreAs);
            types.Add(typeof(Type));
            parameters.Add(collectionMapping.ValueConverterType);
            AddTerm(types, parameters, collectionMapping.GraphIri, collectionMapping.GraphPrefix, collectionMapping.GraphTerm);
            return((AttributeCollectionMappingProvider)typeof(AttributeCollectionMappingProvider)
                   .GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, types.ToArray(), null).Invoke(parameters.ToArray()));
        }
 public void Setup()
 {
     Attribute = new CollectionAttribute(ExpectedPrefix, ExpectedTerm);
     ScenarioSetup();
     TheTest();
 }