コード例 #1
0
        public CollectionConfiguration Register(Accessor accessor)
        {
            var configuration = new CollectionConfiguration(accessor);

            _byAccessor[accessor] = configuration;
            return(configuration);
        }
コード例 #2
0
        public CollectionConfiguration ToConfiguration(PropertyInfo property)
        {
            if (!property.PropertyType.IsGenericEnumerable())
            {
                throw new InvalidOperationException("BlockSettingsAttribute is only valid for generic collections");
            }

            var configuration = new CollectionConfiguration(new SingleProperty(property))
            {
                Name = ExpressAs
            };

            if (ImplicitProperty.IsNotEmpty())
            {
                var targetType = property.PropertyType.FindInterfaceThatCloses(typeof(IEnumerable <>)).GetGenericArguments()[0];
                var target     = Cache.GetPropertiesFor(targetType).SingleOrDefault(x => x.Key.EqualsIgnoreCase(ImplicitProperty)).Value;
                if (target == null)
                {
                    throw new InvalidOperationException("Could not find property: " + ImplicitProperty);
                }

                configuration.Implicit = new SingleProperty(target);
            }

            return(configuration);
        }
コード例 #3
0
 public ConfigureCollectionExpression(CollectionConfiguration configuration)
 {
     _configuration = configuration;
 }