Exemplo n.º 1
0
        internal void GenerateBuildInDomainTypes()
        {
            if (HasBuildInDomainTypes)
            {
                return;
            }

            using (ValidationContextRegion.DisableAll())
            {
                foreach (var typePair in SystemPrimitiveTypesConverter.TypeIds)
                {
                    Guid typeId = typePair.Key;
                    Type type   = typePair.Value;

                    if (!this.DomainTypes.Any(domainType => Util.StringEqual(domainType.Name, type.Name, true) &&
                                              Util.StringEqual(domainType.Namespace, type.Namespace, true)))
                    {
                        var buildInDomainType = new DomainType(this.Partition);

                        this.DomainTypes.Add(buildInDomainType);
                        buildInDomainType.Name      = type.Name;
                        buildInDomainType.Namespace = type.Namespace;
                        buildInDomainType.IsBuildIn = true;
                        buildInDomainType.BuildInID = typeId;
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnCopy(ModelElement sourceElement)
        {
            base.OnCopy(sourceElement);

            NavigationProperty sourceProperty = (NavigationProperty)sourceElement;

            this.TypedEntitySet = sourceProperty.TypedEntitySet;
            this.KeyAttribute   = Common.ExtensionMethods.Clone(sourceProperty.KeyAttribute);

            using (ValidationContextRegion.DisableAll())
            {
                // this will add delete which dispose validation region when transaction completes/rolled-back

                /*this.Store.RegisterActionOnTransactionEvent(TransactionEvent.Committed | TransactionEvent.RolledBack,
                 *  disabledValidationRegion, (args, disposable) => disposable.Dispose());*/

                if (sourceProperty.PersistentTypeHasAssociations != null)
                {
                    this.PersistentTypeHasAssociations =
                        (PersistentTypeHasAssociations)sourceProperty.PersistentTypeHasAssociations.Copy(
                            new[]
                    {
                        PersistentTypeHasAssociations.TargetPersistentTypeDomainRoleId,
                        PersistentTypeHasAssociations.SourcePersistentTypeDomainRoleId
                    });
                }
            }

            if (this.PersistentTypeHasAssociations != null)
            {
                this.PersistentTypeHasAssociations.TargetPersistentType =
                    sourceProperty.PersistentTypeHasAssociations.TargetPersistentType;

                this.PersistentTypeHasAssociations.Name =
                    AssociationConnectorBuilder.BuildAssociationName(
                        this.PersistentTypeHasAssociations.SourcePersistentType,
                        this.PersistentTypeHasAssociations.TargetPersistentType);
            }
        }