private static IList CreateList(Type propertyType)
        {
            Type argumentType = ResolverHelper.GetArgumentType(propertyType);
            Type listType     = typeof(List <>).MakeGenericType(argumentType);

            return(Activator.CreateInstance(listType) as IList);
        }
        public object ResolveItemFieldValue(object rawValue)
        {
            if (rawValue == null)
            {
                return(String.Empty);
            }

            var list = (IList)rawValue;

            if (list.Count == 0)
            {
                return(String.Empty);
            }

            Type argumentType = ResolverHelper.GetArgumentType(rawValue.GetType());

            IValueResolver resolver = GetInnerResolver(argumentType);

            var sb = new StringBuilder();

            foreach (object listItem in list)
            {
                sb.Append(resolver.ResolveItemFieldValue(listItem) + "|");
            }

            return(sb.ToString().Substring(0, sb.Length - 1));
        }
        public bool CanResolve(Type type)
        {
            if (!IsNullableGenericType(type))
            {
                return(false);
            }

            Type argumentType = ResolverHelper.GetArgumentType(type);

            return(argumentType.IsValueType);
        }
        public object ResolveEntityPropertyValue(string rawValue, Type propertyType)
        {
            Type argumentType = ResolverHelper.GetArgumentType(propertyType);
            Type nullableType = typeof(Nullable <>);

            if (!string.IsNullOrEmpty(rawValue))
            {
                object value = GetObjectValue(rawValue, argumentType);
                if (value != null)
                {
                    Type type = nullableType.MakeGenericType(argumentType);
                    return(Activator.CreateInstance(type, value));
                }
            }

            return(ResolverHelper.CreateGenericClassInstance(nullableType, argumentType));
        }
        public object ResolveEntityPropertyValue(string rawValue, Type propertyType)
        {
            IList list = CreateList(propertyType);

            if (string.IsNullOrEmpty(rawValue))
            {
                return(list);
            }

            var delimiter = new [] { SitecoreDataAccess.Settings.ValueDelimiter };

            string[] items = rawValue.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);

            Type           listArgumentType = ResolverHelper.GetArgumentType(propertyType);
            IValueResolver resolver         = GetInnerResolver(listArgumentType);

            foreach (string item in items)
            {
                list.Add(resolver.ResolveEntityPropertyValue(item, listArgumentType));
            }

            return(list);
        }
        private static bool IsGenericParameterOfTypeNotAssignableToISitecoreDomainEnitity(Type propertyType)
        {
            Type argumentType = ResolverHelper.GetArgumentType(propertyType);

            return(!typeof(ISitecoreDomainEntity).IsAssignableFrom(argumentType));
        }