Esempio n. 1
0
        private Replacer.ReplaceInfo[] GetReferencedPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties, bool isList)
        {
            ArrayList replaceInfosArrayList = new ArrayList();

            foreach (PropertyBase property in properties)
            {
                if (!HasInterface(property.GetType(), "Remotion.ObjectBinding.IBusinessObjectReferenceProperty") || isList != property.IsList)
                {
                    continue;
                }

                Type     itemType = property.IsList ? property.ListInfo.ItemType : property.PropertyType;
                string[] referencedClassNameInfo = itemType.FullName.Split('.');
                string   referencedClassName     = referencedClassNameInfo[referencedClassNameInfo.Length - 1];

                Replacer.ReplaceInfo replaceInfo = new Replacer.ReplaceInfo();

                replaceInfo.replaceInfos = new string[] {
                    Placeholder.ToString(DefinedPlaceholder.DOMAIN_REFERENCEDCLASSNAME), referencedClassName,
                    Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier
                };

                replaceInfosArrayList.Add(replaceInfo);
            }

            Replacer.ReplaceInfo[] replaceInfos = new Replacer.ReplaceInfo[replaceInfosArrayList.Count];

            for (int i = 0; i < replaceInfos.Length; i++)
            {
                replaceInfos[i] = (Replacer.ReplaceInfo)replaceInfosArrayList[i];
            }

            return(replaceInfos);
        }
 protected override void HandlePropertyNotFound(IBusinessObjectClass businessObjectClass, string propertyIdentifier)
 {
     throw new Exception(
               string.Format(
                   "HandlePropertyNotFound, class: {0}, property: {1}",
                   businessObjectClass.Identifier,
                   propertyIdentifier));
 }
Esempio n. 3
0
        public void SetUp()
        {
            _implementationMock = MockRepository.GenerateMock <IBindableObjectWithIdentityBaseImplementation> ();
            _instance           = new ClassDerivedFromBindableObjectWithIdentityBase(_implementationMock);

            _propertyFake            = MockRepository.GenerateMock <IBusinessObjectProperty> ();
            _businessObjectClassFake = MockRepository.GenerateMock <IBusinessObjectClass> ();
        }
        protected IBusinessObjectProperty CreatePropertyStub(IBusinessObjectClass classStub, string propertyIdentifier)
        {
            var propertyStub = MockRepository.GenerateStub <IBusinessObjectProperty>();

            propertyStub.Stub(_ => _.Identifier).Return(propertyIdentifier);
            classStub.Stub(_ => _.GetPropertyDefinition(propertyIdentifier)).Return(propertyStub);
            return(propertyStub);
        }
 public HelpInfo GetHelpInfo(
     IBusinessObjectBoundWebControl control,
     IBusinessObjectClass businessObjectClass,
     IBusinessObjectProperty businessObjectProperty,
     IBusinessObject businessObject)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 protected override void HandlePropertyNotFound(IBusinessObjectClass businessObjectClass, string propertyIdentifier)
 {
     throw new ParseException(
               string.Format(
                   "BusinessObjectClass '{0}' does not contain a property named '{1}'.",
                   businessObjectClass.Identifier,
                   propertyIdentifier));
 }
 /// <summary> Returns the default value to be assumed if the boolean property returns <see langword="null"/>. </summary>
 /// <param name="objectClass"> The <see cref="IBusinessObjectClass"/> for which to get the property's default value. </param>
 /// <remarks>
 ///   If <see langword="null"/> is returned, the object model does not define a default value. In case the
 ///   caller requires a default value, the selection of the appropriate value is left to the caller.
 /// </remarks>
 public bool?GetDefaultValue(IBusinessObjectClass objectClass)
 {
     if (IsNullable)
     {
         return(null);
     }
     return(false);
 }
Esempio n. 8
0
        public override void SetUp()
        {
            base.SetUp();

            _implementationMock = MockRepository.GenerateMock <IBindableDomainObjectImplementation> ();

            _propertyFake            = MockRepository.GenerateMock <IBusinessObjectProperty> ();
            _businessObjectClassFake = MockRepository.GenerateMock <IBusinessObjectClass> ();
        }
 protected override void HandlePropertyNotLastPropertyAndNotReferenceProperty(
     IBusinessObjectClass businessObjectClass, IBusinessObjectProperty property)
 {
     throw new Exception(
               string.Format(
                   "HandlePropertyNotLastPropertyAndNotReferenceProperty, class: {0}, property: {1}",
                   businessObjectClass.Identifier,
                   property.Identifier));
 }
Esempio n. 10
0
 protected override void HandlePropertyNotLastPropertyAndNotReferenceProperty(
     IBusinessObjectClass businessObjectClass, IBusinessObjectProperty property)
 {
     throw new ParseException(
               string.Format(
                   "Each property in a property path except the last one must be a reference property. Property '{0}' is of type '{1}'.",
                   property.Identifier,
                   property.GetType().Name));
 }
Esempio n. 11
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new GroupTypePropertyTypeSearchService();
            IBusinessObjectClass groupClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Group));

            _property = (IBusinessObjectReferenceProperty)groupClass.GetPropertyDefinition("GroupType");
            Assert.That(_property, Is.Not.Null);
        }
Esempio n. 12
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new SubstitutionPropertiesSearchService();
            IBusinessObjectClass substitutionClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Substitution));

            _otherProperty = (IBusinessObjectReferenceProperty)substitutionClass.GetPropertyDefinition("SubstitutedUser");
            Assert.That(_otherProperty, Is.Not.Null);
        }
Esempio n. 13
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new GroupPropertyTypeSearchService();
            IBusinessObjectClass userClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(User));

            _tenantProperty = (IBusinessObjectReferenceProperty)userClass.GetPropertyDefinition("Tenant");
            Assert.That(_tenantProperty, Is.Not.Null);
        }
Esempio n. 14
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new RolePropertiesSearchService();

            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _positionProperty = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("Position");
            Assert.That(_positionProperty, Is.Not.Null);
        }
Esempio n. 15
0
        public override void SetUp()
        {
            base.SetUp();

            _aceClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(AccessControlEntry));

            _testHelper = new AccessControlTestHelper();
            _testHelper.Transaction.EnterNonDiscardingScope();

            _ace = AccessControlEntry.NewObject();
        }
        /// <summary>
        ///   Adds the <see cref="IBusinessObjectProperty"/> objects found in
        ///   <paramref name="businessObjectClass"/> to the <see cref="TreeNodeCollection"/>.
        /// </summary>
        /// <param name="nodes">
        ///   The <see cref="TreeNodeCollection"/> to which the <see cref="IBusinessObjectProperty"/>
        ///   objects of the <paramref name="businessObjectClass"/> will be added.
        /// </param>
        /// <param name="businessObjectClass">
        ///   The <see cref="IBusinessObjectClass"/> to use as a property source.
        /// </param>
        private void AddReferenceClassProperties(
            TreeNodeCollection nodes,
            IBusinessObjectClass businessObjectClass)
        {
            IBusinessObjectProperty[] properties = businessObjectClass.GetPropertyDefinitions();

            foreach (IBusinessObjectProperty property in properties)
            {
                AddProperty(nodes, property, false);
            }
        }
        public override void SetUp()
        {
            base.SetUp();
            _classWithPropertiesInstance      = BindableDomainObjectWithProperties.NewObject();
            _classWithPropertiesMixin         = Mixin.Get <BindableDomainObjectMixin> (_classWithPropertiesInstance);
            _classWithMixedPropertiesInstance = BindableDomainObjectWithMixedPersistentProperties.NewObject();

            _classWithPropertiesMixinInstanceAsBusinessObject      = _classWithPropertiesMixin;
            _classWithPropertiesMixinInstanceAsBusinessObjectClass = _classWithPropertiesMixinInstanceAsBusinessObject.BusinessObjectClass;

            _classWithMixedPropertiesInstanceAsBusinessObject      = _classWithMixedPropertiesInstance;
            _classWithMixedPropertiesInstanceAsBusinessObjectClass = _classWithMixedPropertiesInstanceAsBusinessObject.BusinessObjectClass;
        }
Esempio n. 18
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new SubstitutionPropertiesSearchService();
            IBusinessObjectClass substitutionClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Substitution));

            _substitutedRoleProperty = (IBusinessObjectReferenceProperty)substitutionClass.GetPropertyDefinition("SubstitutedRole");
            Assert.That(_substitutedRoleProperty, Is.Not.Null);

            _user = User.FindByUserName("group0/user1");
            Assert.That(_user, Is.Not.Null);
        }
Esempio n. 19
0
        public override void SetUp()
        {
            base.SetUp();

            _testHelper = new OrganizationalStructureTestHelper();
            _testHelper.Transaction.EnterNonDiscardingScope();

            _searchService = new AbstractRoleDefinitionPropertyTypeSearchService();
            IBusinessObjectClass aceClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(AccessControlEntry));

            _property = (IBusinessObjectReferenceProperty)aceClass.GetPropertyDefinition("AccessControlList");
            Assert.That(_property, Is.Not.Null);
        }
Esempio n. 20
0
        // TODO: remove
        private bool IgnoreClass(IBusinessObjectClass theClass)
        {
            string[] ignoreClasses = _configuration.IgnoreClasses;

            foreach (string className in ignoreClasses)
            {
                if (className == theClass.Identifier)
                {
                    return(true);
                }
            }

            return(false);
        }
 public void SetUp()
 {
     _businessObjectStub            = MockRepository.GenerateStub <IBusinessObject>();
     _businessObjectClassStub       = MockRepository.GenerateStub <IBusinessObjectClass>();
     _dataSourceStub                = MockRepository.GenerateStub <IBusinessObjectDataSource>();
     _dataSourceStub.BusinessObject = _businessObjectStub;
     _dataSourceStub.Mode           = DataSourceMode.Edit;
     _dataSourceStub.Stub(_ => _.BusinessObjectClass).Return(_businessObjectClassStub);
     _propertyStub = MockRepository.GenerateStub <IBusinessObjectProperty>();
     _propertyStub.Stub(_ => _.ReflectedClass).Return(_businessObjectClassStub);
     _readOnlyPropertyStub = MockRepository.GenerateStub <IBusinessObjectProperty>();
     _readOnlyPropertyStub.Stub(_ => _.ReflectedClass).Return(_businessObjectClassStub);
     _readOnlyPropertyStub.Stub(stub => stub.IsReadOnly(Arg <IBusinessObject> .Is.Anything)).Return(true);
     _control = new TestableBusinessObjectBoundEditableWebControl();
 }
Esempio n. 22
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new UserPropertyTypeSearchService();
            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _property = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("User");
            Assert.That(_property, Is.Not.Null);

            var user = User.FindByUserName("group0/user1");

            Assert.That(user, Is.Not.Null);

            _tenantConstraint = new TenantConstraint(user.Tenant.GetHandle());
        }
Esempio n. 23
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new GroupPropertyTypeSearchService();
            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _property = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("Group");
            Assert.That(_property, Is.Not.Null);

            var group = Group.FindByUnqiueIdentifier("UID: group0");

            Assert.That(group, Is.Not.Null);

            _tenantConstraint = new TenantConstraint(group.Tenant.GetHandle());
        }
        public HelpInfo GetHelpInfo(
            IBusinessObjectBoundWebControl control,
            IBusinessObjectClass businessObjectClass,
            IBusinessObjectProperty businessObjectProperty,
            IBusinessObject businessObject)
        {
            ArgumentUtility.CheckNotNull("control", control);
            ArgumentUtility.CheckNotNull("businessObjectClass", businessObjectClass);

            return(new ToolTipBasedHelpInfo(string.Format(
                                                "{0}\r\n{1}\r\n{2}\r\n{3}",
                                                control.ID,
                                                businessObjectClass.Identifier,
                                                (businessObjectProperty != null ? businessObjectProperty.Identifier : "prop"),
                                                (businessObject is IBusinessObjectWithIdentity ? ((IBusinessObjectWithIdentity)businessObject).DisplayName : "obj"))));
        }
Esempio n. 25
0
        public override void SetUp()
        {
            base.SetUp();

            _businessObjectProvider             = CreateBindableObjectProviderWithStubBusinessObjectServiceFactory();
            _bindableObjectGlobalizationService = SafeServiceLocator.Current.GetInstance <BindableObjectGlobalizationService>();
            ClassReflector classReflector = new ClassReflector(
                typeof(ClassWithValueType <bool>),
                _businessObjectProvider,
                BindableObjectMetadataFactory.Create(),
                _bindableObjectGlobalizationService);

            _businessObjectClass = classReflector.GetMetadata();

            _mockRepository = new MockRepository();
        }
Esempio n. 26
0
        private void BuildGlobalFiles(ClassInfo[] classInfos, EnumInfo[] enumInfos)
        {
            foreach (Configuration.FileInfo fileInfo in _configuration.AllGlobalFileInfos)
            {
                string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template);

                string targetFileName = Path.Combine(_configuration.TargetRoot, fileInfo.target);
                targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName);

                CheckExistenceTemplateFile(templateFileName);
                CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite);

                IBusinessObjectClass[] businessObjectClasses = new IBusinessObjectClass[classInfos.Length];

                for (int index = 0; index < classInfos.Length; index++)
                {
                    businessObjectClasses[index] = classInfos[index].objectClass;
                }

                Replacer replacer = new Replacer(templateFileName);

                // for each class
                replacer.Include(
                    DefinedPlaceholder.INCLUDE_FOREACHCLASS,
                    GetClassInfos(businessObjectClasses));

                replacer.Repeat(
                    DefinedPlaceholder.REPEAT_FOREACHCLASS_BEGIN,
                    DefinedPlaceholder.REPEAT_FOREACHCLASS_END,
                    GetClassInfos(businessObjectClasses));

                // for each enum
                replacer.Include(
                    DefinedPlaceholder.INCLUDE_FOREACHENUM,
                    GetEnumInfos(enumInfos));

                replacer.Repeat(
                    DefinedPlaceholder.REPEAT_FOREACHENUM_BEGIN,
                    DefinedPlaceholder.REPEAT_FOREACHENUM_END,
                    GetEnumInfos(enumInfos));

                // common
                ReplaceCommon(replacer, classInfos[0].type);

                replacer.Save(targetFileName);
            }
        }
Esempio n. 27
0
        public void GetBusinessObjectClass_SameTwice()
        {
            SetupResult.For(
                _typeResolutionServiceMock.GetType(
                    "Remotion.ObjectBinding.UnitTests.TestDomain.SimpleBusinessObjectClass, Remotion.ObjectBinding.UnitTests", true))
            .Return(typeof(SimpleBusinessObjectClass));
            _mockRepository.ReplayAll();

            _dataSource.Type = typeof(SimpleBusinessObjectClass);

            IBusinessObjectClass actual = _dataSource.BusinessObjectClass;

            Assert.That(actual, Is.Not.Null);
            Assert.That(actual, Is.SameAs(_dataSource.BusinessObjectClass));

            _mockRepository.VerifyAll();
        }
Esempio n. 28
0
        public void GetBusinessObjectClass_WithTypeDerivedFromBaseClass()
        {
            Expect.Call(
                _typeResolutionServiceMock.GetType(
                    "Remotion.ObjectBinding.UnitTests.TestDomain.ClassDerivedFromBindableObjectBase, Remotion.ObjectBinding.UnitTests", true))
            .Return(typeof(ClassDerivedFromBindableObjectBase))
            .Repeat.AtLeastOnce();
            _mockRepository.ReplayAll();

            _dataSource.Type = typeof(ClassDerivedFromBindableObjectBase);
            IBusinessObjectClass actual = _dataSource.BusinessObjectClass;

            Assert.That(actual, Is.Not.Null);
            Assert.That(actual.BusinessObjectProvider, Is.SameAs(BindableObjectProvider.GetProviderForBindableObjectType(typeof(ClassDerivedFromBindableObjectBase))));

            _mockRepository.VerifyAll();
        }
        public void UseBusinessObjectClassService()
        {
            IBusinessObjectClassService mockService   = _mockRepository.StrictMock <IBusinessObjectClassService>();
            IBusinessObjectClass        expectedClass = _mockRepository.Stub <IBusinessObjectClass>();
            IBusinessObject             businessObjectFromOtherBusinessObjectProvider = _mockRepository.Stub <IBusinessObject>();
            Type typeFromOtherBusinessObjectProvider  = businessObjectFromOtherBusinessObjectProvider.GetType();
            IBusinessObjectReferenceProperty property = CreateProperty("Scalar", typeFromOtherBusinessObjectProvider);

            Expect.Call(mockService.GetBusinessObjectClass(typeFromOtherBusinessObjectProvider)).Return(expectedClass);
            _mockRepository.ReplayAll();

            _bindableObjectProvider.AddService(typeof(IBusinessObjectClassService), mockService);
            IBusinessObjectClass actualClass = property.ReferenceClass;

            _mockRepository.VerifyAll();
            Assert.That(actualClass, Is.SameAs(expectedClass));
        }
        public bool MoveNext(IBusinessObjectClass currentClass)
        {
            ArgumentUtility.CheckNotNull("currentClass", currentClass);

            if (_index == _properties.Length)
            {
                return(false);
            }

            _index++;

            if (_index == _properties.Length)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 31
0
        private Replacer.ReplaceInfo[] GetPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties)
        {
            Replacer.ReplaceInfo[] propertyInfos = new Replacer.ReplaceInfo[properties.Length];

            for (int index = 0; index < properties.Length; index++)
            {
                IBusinessObjectProperty property = properties[index];
                bool found = false;

                foreach (Configuration.ControlInfo controlMapping in _configuration.ControlMappings)
                {
                    if (HasInterface(property.GetType(), controlMapping.propertyType) && property.IsList == controlMapping.isList)
                    {
                        ApplicationConfiguration.ReplaceInfo[] additionalReplaceInfos = new ApplicationConfiguration.ReplaceInfo[] {
                            new ApplicationConfiguration.ReplaceInfo(Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier)
                        };

                        string additionalAttributes = Replacer.Replace(additionalReplaceInfos, controlMapping.additionalAttributes);
                        string additionalElements = Replacer.Replace(additionalReplaceInfos, controlMapping.additionalElements);

                        propertyInfos[index].replaceInfos = new string[] {
                            Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier,
                            Placeholder.ToString(DefinedPlaceholder.CONTROLTYPE), controlMapping.controlName,
                            Placeholder.ToString(DefinedPlaceholder.ADDITIONALATTRIBUTES), additionalAttributes,
                            Placeholder.ToString(DefinedPlaceholder.ADDITIONALELEMENTS), additionalElements
                        };

                        found = true;
                        break;
                    }
                }

                if (! found)
                {
                    propertyInfos[index].replaceInfos = null;

                    _warnings.AddWarning(WarningCode.MissingControlMapping, businessObjectClass.Identifier + "." + property.Identifier +
                            " (" + property.GetType().ToString() + ")");
                }
            }

            return propertyInfos;
        }
Esempio n. 32
0
        private void BuildClassFile(Type type, IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties)
        {
            foreach (Configuration.FileInfo fileInfo in _configuration.ClassFileInfos)
            {
                string name = GetName(businessObjectClass.Identifier);
                string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template);

                string targetFileName = Path.Combine(_configuration.TargetRoot, Replace(fileInfo.target, DefinedPlaceholder.DOMAIN_CLASSNAME, name));
                targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName);

                CheckExistenceTemplateFile(templateFileName);
                CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite);

                Replacer replacer = new Replacer(templateFileName);

                // for each property
                replacer.Include(
                        DefinedPlaceholder.INCLUDE_FOREACHPROPERTY,
                        GetPropertyInfos(businessObjectClass, properties));

                replacer.Repeat(
                        DefinedPlaceholder.REPEAT_FOREACHPROPERTY_BEGIN,
                        DefinedPlaceholder.REPEAT_FOREACHPROPERTY_END,
                        GetPropertyInfos(businessObjectClass, properties));

                replacer.Repeat(
                        DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_BEGIN,
                        DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_END,
                        GetReferencedPropertyInfos(businessObjectClass, properties, true),
                        "isList=true");

                replacer.Repeat(
                        DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_BEGIN,
                        DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_END,
                        GetReferencedPropertyInfos(businessObjectClass, properties, false),
                        "isList=false");

                // common
                replacer.Replace(DefinedPlaceholder.DOMAIN_CLASSNAME, name);
                ReplaceCommon(replacer, type);

                replacer.Save(targetFileName);
            }
        }
Esempio n. 33
0
        private void BuildGlobalFiles(ClassInfo[] classInfos, EnumInfo[] enumInfos)
        {
            foreach (Configuration.FileInfo fileInfo in _configuration.AllGlobalFileInfos)
            {
                string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template);

                string targetFileName = Path.Combine(_configuration.TargetRoot, fileInfo.target);
                targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName);

                CheckExistenceTemplateFile(templateFileName);
                CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite);

                IBusinessObjectClass[] businessObjectClasses = new IBusinessObjectClass[classInfos.Length];

                for (int index = 0; index < classInfos.Length; index++)
                    businessObjectClasses[index] = classInfos[index].objectClass;

                Replacer replacer = new Replacer(templateFileName);

                // for each class
                replacer.Include(
                        DefinedPlaceholder.INCLUDE_FOREACHCLASS,
                        GetClassInfos(businessObjectClasses));

                replacer.Repeat(
                        DefinedPlaceholder.REPEAT_FOREACHCLASS_BEGIN,
                        DefinedPlaceholder.REPEAT_FOREACHCLASS_END,
                        GetClassInfos(businessObjectClasses));

                // for each enum
                replacer.Include(
                        DefinedPlaceholder.INCLUDE_FOREACHENUM,
                        GetEnumInfos(enumInfos));

                replacer.Repeat(
                        DefinedPlaceholder.REPEAT_FOREACHENUM_BEGIN,
                        DefinedPlaceholder.REPEAT_FOREACHENUM_END,
                        GetEnumInfos(enumInfos));

                // common
                ReplaceCommon(replacer, classInfos[0].type);

                replacer.Save(targetFileName);
            }
        }
Esempio n. 34
0
        private Replacer.ReplaceInfo[] GetClassInfos(IBusinessObjectClass[] classes)
        {
            Replacer.ReplaceInfo[] classInfos = new Replacer.ReplaceInfo[classes.Length];

            for (int index = 0; index < classes.Length; index++)
            {
                classInfos[index].replaceInfos = new string[] {
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_CLASSNAME), GetName(classes[index].Identifier) };
            }

            return classInfos;
        }
Esempio n. 35
0
        private Replacer.ReplaceInfo[] GetReferencedPropertyInfos(IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties, bool isList)
        {
            ArrayList replaceInfosArrayList = new ArrayList();

            foreach (PropertyBase property in properties)
            {
                if (! HasInterface(property.GetType(), "Remotion.ObjectBinding.IBusinessObjectReferenceProperty") || isList != property.IsList)
                    continue;

              Type itemType = property.IsList ? property.ListInfo.ItemType : property.PropertyType;
            string[] referencedClassNameInfo = itemType.FullName.Split ('.');
                string referencedClassName = referencedClassNameInfo[referencedClassNameInfo.Length - 1];

                Replacer.ReplaceInfo replaceInfo = new Replacer.ReplaceInfo();

                replaceInfo.replaceInfos = new string[] {
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_REFERENCEDCLASSNAME), referencedClassName,
                        Placeholder.ToString(DefinedPlaceholder.DOMAIN_PROPERTYNAME), property.Identifier
                };

                replaceInfosArrayList.Add(replaceInfo);
            }

            Replacer.ReplaceInfo[] replaceInfos = new Replacer.ReplaceInfo[replaceInfosArrayList.Count];

            for (int i=0; i<replaceInfos.Length; i++)
                replaceInfos[i] = (Replacer.ReplaceInfo)replaceInfosArrayList[i];

            return replaceInfos;
        }
Esempio n. 36
0
        // TODO: remove
        private bool IgnoreClass(IBusinessObjectClass theClass)
        {
            string[] ignoreClasses = _configuration.IgnoreClasses;

            foreach (string className in ignoreClasses)
            {
                if (className == theClass.Identifier)
                    return true;
            }

            return false;
        }