Exemplo n.º 1
0
        private BindableObjectClass CreateBindableObjectClass(Type type)
        {
            if (!IsBindableObjectImplementation(type))
            {
                if (type.ContainsGenericParameters)
                {
                    throw new ArgumentException(
                              string.Format(
                                  "The type '{0}' is not a bindable object implementation. Open generic types are not supported.",
                                  type.FullName),
                              "type");
                }

                throw new ArgumentException(
                          string.Format(
                              "The type '{0}' is not a bindable object implementation. It must either have a mixin derived from BindableObjectMixinBase<T> applied "
                              + "or implement the IBusinessObject interface and apply the BindableObjectBaseClassAttribute.",
                              type.FullName),
                          "type");
            }

            IClassReflector classReflector = _metadataFactory.CreateClassReflector(type, this);

            Assertion.IsNotNull(classReflector, "The IMetadataFactory.CreateClassReflector method evaluated and returned null.");

            return(classReflector.GetMetadata());
        }