public ClassDefinition(
            string id,
            Type classType,
            bool isAbstract,
            ClassDefinition baseClass,
            Type storageGroupType,
            IPersistentMixinFinder persistentMixinFinder,
            IDomainObjectCreator instanceCreator)
        {
            ArgumentUtility.CheckNotNullOrEmpty("id", id);
            ArgumentUtility.CheckNotNull("classType", classType);
            ArgumentUtility.CheckNotNull("persistentMixinFinder", persistentMixinFinder);

            _id = id;
            _storageGroupType = storageGroupType;

            _classType             = classType;
            _persistentMixinFinder = persistentMixinFinder;
            _isAbstract            = isAbstract;

            _propertyAccessorDataCache         = new PropertyAccessorDataCache(this);
            _cachedRelationEndPointDefinitions = new DoubleCheckedLockingContainer <RelationEndPointDefinitionCollection> (
                () => RelationEndPointDefinitionCollection.CreateForAllRelationEndPoints(this, true));
            _cachedPropertyDefinitions =
                new DoubleCheckedLockingContainer <PropertyDefinitionCollection> (
                    () => new PropertyDefinitionCollection(PropertyDefinitionCollection.CreateForAllProperties(this, true), true));

            _baseClass       = baseClass;
            _instanceCreator = instanceCreator;
            _handleCreator   = new Lazy <Func <ObjectID, IDomainObjectHandle <DomainObject> > > (BuildHandleCreator, LazyThreadSafetyMode.PublicationOnly);
        }
 protected abstract PropertyFinderBase CreateNewFinder(
     Type type,
     bool includeBaseProperties,
     bool includeMixinProperties,
     IMemberInformationNameResolver nameResolver,
     IPersistentMixinFinder persistentMixinFinder,
     IPropertyMetadataProvider propertyMetadataProvider);
 public StubPropertyFinderBase(
     Type type,
     bool includeBaseProperties,
     bool includeMixinProperties,
     IMemberInformationNameResolver nameResolver,
     IPersistentMixinFinder persistentMixinFinder,
     IPropertyMetadataProvider propertyMetadataProvider)
     : base(type, includeBaseProperties, includeMixinProperties, nameResolver, persistentMixinFinder, propertyMetadataProvider)
 {
 }
 public ClassDefinitionWithUnresolvedClassType(
     string id,
     Type classType,
     bool isAbstract,
     ClassDefinition baseClass,
     IPersistentMixinFinder persistentMixinFinder,
     IDomainObjectCreator instanceCreator)
     : base(id, classType, isAbstract, baseClass, null, persistentMixinFinder, instanceCreator)
 {
 }
        public MixinPropertyFinder(
            Func <Type, bool, bool, PropertyFinderBase> propertyFinderFactory,
            IPersistentMixinFinder persistentMixinFinder,
            bool includeBaseMixins)
        {
            ArgumentUtility.CheckNotNull("propertyFinderFactory", propertyFinderFactory);

            _propertyFinderFactory = propertyFinderFactory;
            _persistentMixinFinder = persistentMixinFinder;
            _includeBaseMixins     = includeBaseMixins;
        }
 public StubPropertyFinderBase(
     Type type,
     bool includeBaseProperties,
     bool includeMixinProperties,
     IPersistentMixinFinder persistentMixinFinder)
     : this(
         type,
         includeBaseProperties,
         includeMixinProperties,
         new ReflectionBasedMemberInformationNameResolver(),
         persistentMixinFinder,
         new PropertyMetadataReflector())
 {
 }
示例#7
0
        public NameBasedPropertyFinder(
            string propertyName,
            Type type,
            bool includeBaseProperties,
            bool includeMixinProperties,
            IMemberInformationNameResolver nameResolver,
            IPersistentMixinFinder persistentMixinFinder,
            IPropertyMetadataProvider propertyMetadataProvider)
            : base(type, includeBaseProperties, includeMixinProperties, nameResolver, persistentMixinFinder, propertyMetadataProvider)
        {
            ArgumentUtility.CheckNotNullOrEmpty("propertyName", propertyName);

            _propertyName = propertyName;
        }
        public static ClassDefinition CreateClassDefinitionWithTable(
            StorageProviderDefinition storageProviderDefinition,
            string id                 = null,
            Type classType            = null,
            bool isAbstract           = false,
            ClassDefinition baseClass = null,
            Type storageGroupType     = null,
            IPersistentMixinFinder persistentMixinFinder = null,
            IDomainObjectCreator instanceCreator         = null)
        {
            var classDefinition = CreateClassDefinition(id, classType, isAbstract, baseClass, storageGroupType, persistentMixinFinder, instanceCreator);

            classDefinition.SetStorageEntity(TableDefinitionObjectMother.Create(storageProviderDefinition));
            return(classDefinition);
        }
 protected override PropertyFinderBase CreateNewFinder(
     Type type,
     bool includeBaseProperties,
     bool includeMixinProperties,
     IMemberInformationNameResolver nameResolver,
     IPersistentMixinFinder persistentMixinFinder,
     IPropertyMetadataProvider propertyMetadataProvider)
 {
     return(new StubPropertyFinderBase(
                type,
                includeBaseProperties,
                includeMixinProperties,
                nameResolver,
                persistentMixinFinder,
                propertyMetadataProvider));
 }
        public static ClassDefinition CreateClassDefinition(
            string id                 = null,
            Type classType            = null,
            bool isAbstract           = false,
            ClassDefinition baseClass = null,
            Type storageGroupType     = null,
            IPersistentMixinFinder persistentMixinFinder = null,
            IDomainObjectCreator instanceCreator         = null)
        {
            id                    = id ?? "Test";
            classType             = classType ?? typeof(Order);
            persistentMixinFinder = persistentMixinFinder ?? new PersistentMixinFinderStub(classType, Type.EmptyTypes);
            instanceCreator       = instanceCreator ?? MockRepository.GenerateStrictMock <IDomainObjectCreator>();

            return(new ClassDefinition(id, classType, isAbstract, baseClass, storageGroupType, persistentMixinFinder, instanceCreator));
        }
示例#11
0
        public PropertyFinder(
            Type type,
            ClassDefinition classDefinition,
            bool includeBaseProperties,
            bool includeMixinProperties,
            IMemberInformationNameResolver nameResolver,
            IPersistentMixinFinder persistentMixinFinder,
            IPropertyMetadataProvider propertyMetadataProvider,
            IDomainModelConstraintProvider domainModelConstraintProvider)
            : base(type, includeBaseProperties, includeMixinProperties, nameResolver, persistentMixinFinder, propertyMetadataProvider)
        {
            ArgumentUtility.CheckNotNull("classDefinition", classDefinition);

            _classDefinition = classDefinition;
            _domainModelConstraintProvider = domainModelConstraintProvider;
        }
示例#12
0
 protected override PropertyFinderBase CreateNewFinder(
     Type type,
     bool includeBaseProperties,
     bool includeMixinProperties,
     IMemberInformationNameResolver nameResolver,
     IPersistentMixinFinder persistentMixinFinder,
     IPropertyMetadataProvider propertyMetadataProvider)
 {
     return(new PropertyFinder(
                type,
                _classDefinition,
                includeBaseProperties,
                includeMixinProperties,
                nameResolver,
                persistentMixinFinder,
                propertyMetadataProvider,
                _domainModelConstraintProvider));
 }
        protected override PropertyFinderBase CreateNewFinder(
            Type type,
            bool includeBaseProperties,
            bool includeMixinProperties,
            IMemberInformationNameResolver nameResolver,
            IPersistentMixinFinder persistentMixinFinder,
            IPropertyMetadataProvider propertyMetadataProvider)
        {
            ArgumentUtility.CheckNotNull("type", type);
            ArgumentUtility.CheckNotNull("nameResolver", nameResolver);
            ArgumentUtility.CheckNotNull("persistentMixinFinder", persistentMixinFinder);
            ArgumentUtility.CheckNotNull("propertyMetadataProvider", propertyMetadataProvider);

            return(new AllMappingPropertiesFinder(
                       type,
                       includeBaseProperties,
                       includeMixinProperties,
                       nameResolver,
                       persistentMixinFinder,
                       propertyMetadataProvider));
        }
        protected PropertyFinderBase(
            Type type,
            bool includeBaseProperties,
            bool includeMixinProperties,
            IMemberInformationNameResolver nameResolver,
            IPersistentMixinFinder persistentMixinFinder,
            IPropertyMetadataProvider propertyMetadataProvider)
        {
            ArgumentUtility.CheckNotNull("type", type);
            ArgumentUtility.CheckNotNull("nameResolver", nameResolver);
            ArgumentUtility.CheckNotNull("persistentMixinFinder", persistentMixinFinder);
            ArgumentUtility.CheckNotNull("propertyMetadataProvider", propertyMetadataProvider);

            _type = type;
            _includeBaseProperties            = includeBaseProperties;
            _includeMixinProperties           = includeMixinProperties;
            _nameResolver                     = nameResolver;
            _persistentMixinFinder            = persistentMixinFinder;
            _propertyMetadataProvider         = propertyMetadataProvider;
            _explicitInterfaceImplementations = new Lazy <HashSet <IMethodInformation> > (
                () => new HashSet <IMethodInformation> (
                    s_explicitInterfaceImplementations.GetOrCreateValue(_type, GetExplicitInterfaceImplementations)
                    .Select(MethodInfoAdapter.Create)));
        }
示例#15
0
 public void SetUp()
 {
     _persistentMixinFinderStub = MockRepository.GenerateStub <IPersistentMixinFinder>();
 }