public override bool Matches(ObjectIdentifier name, ModelTypeClass type, DeploymentStep step = null)
        {
            bool matches = true;

            for (int i = 0; i < name.Parts.Count && i < _matchParts.Length; i++)
            {
                // Match names right-to-left, since specificity of a SQL identifier is right-to-left,
                // and so this behaves identically to NamedObjectFilterRule if the requested match
                // contains only one argument.
                var part  = name.Parts[name.Parts.Count - 1 - i];
                var match = _matchParts[_matchParts.Length - 1 - i];
                if (!match.IsMatch(part))
                {
                    matches = false;
                    break;
                }
            }

            if (matches && MatchType == MatchType.DoesMatch)
            {
                return(true);
            }

            return(!matches && MatchType == MatchType.DoesNotMatch);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// Source	    Destination DropObjectsNotInSource	FilterType	Generates	Result
        /// dbo.Table	Missing	    TRUE	                Keep	    Create	    Leave in deploy
        /// Missing	    dbo.Table	TRUE	                Keep	    Drop	    Remove from deploy
        /// dbo.Table	Missing	    TRUE	                Ignore	    Create	    Remove from deploy
        /// Missing	    dbo.Table	TRUE	                Ignore	    Drop	    Remove from deploy
        /// dbo.Table	Missing	    TRUE	                None	    Create	    Leave in deploy
        /// Missing	    dbo.Table	TRUE	                None	    Drop	    Leave in deploy
        /// </summary>
        /// <param name="name"></param>
        /// <param name="objectType"></param>
        /// <param name="stepType"></param>
        /// <param name="step"></param>
        /// <returns></returns>
        public bool ShouldRemoveFromPlan(ObjectIdentifier name, ModelTypeClass objectType, StepType stepType, DeploymentStep step = null)
        {
            if (stepType == StepType.Other)
            {
                return(false);
            }

            foreach (var rule in _rules)
            {
                var operation = rule.Operation();

                if (operation == FilterOperation.Ignore && rule.Matches(name, objectType))
                {
                    return(true);
                }

                if (operation == FilterOperation.Keep && stepType == StepType.Drop && rule.Matches(name, objectType))
                {
                    return(true);
                }

                if (operation == FilterOperation.Keep && stepType == StepType.Alter && rule.Matches(name, objectType, step))
                {
                    return(true);
                }
            }

            return(false);
        }
        public override bool Matches(ObjectIdentifier name, ModelTypeClass type, DeploymentStep step = null)
        {
            bool result = (Schema == null || Schema.Equals(name.GetSchemaName(type))) &&
                          Matches(type.Name);

            return(result);
        }
        public override bool Matches(ObjectIdentifier name, ModelTypeClass type, DeploymentStep step = null)
        {
            foreach (var part in name.Parts)
            {
                if (!String.IsNullOrEmpty(part) && (Matches(part)))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #5
0
        public TSqlModelElementReference(ModelRelationshipInstance relationshipReference, ModelTypeClass typeClass) :
            this(relationshipReference)
        {
            if (relationshipInstance.Object != null && relationshipInstance.Object.ObjectType != typeClass)
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
                                                          ModelMessages.InvalidObjectType, relationshipInstance.Object.ObjectType.Name, typeClass.Name),
                                            "typeClass");
            }

            predefinedTypeClass = typeClass;
        }
 public TSqlModelElement(TSqlObject obj, ModelTypeClass typeClass)
 {
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     else if (obj.ObjectType != typeClass)
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
                                                   ModelMessages.InvalidObjectType, obj.ObjectType.Name, typeClass.Name),
                                     "typeClass");
     }
     Element = obj;
 }
Beispiel #7
0
        private void DisplayTopLevelNode(ItemsControl rootNode, string header, ModelTypeClass type)
        {
            var newNode = new TreeViewItem {
                Header = header, Foreground = _defaultForeground
            };

            var objects = _model.GetObjects(DacQueryScopes.All, type);

            foreach (var child in objects)
            {
                var childTreeNode = AddTreeItem(child.Name.ToString(), newNode, _defaultForeground);
                DisplayObject(header, child, childTreeNode);
            }

            if (newNode.Items.Count > 0)
            {
                rootNode.Items.Add(newNode);
            }
        }
        /// <summary>
        /// Determines if instances of <see cref="TSqlModelElement"/> for the <paramref name="typeClass"/> model 
        /// element class will derive from or implement the interface type <paramref name="type"/>.
        /// </summary>
        /// <param name="typeClass">Model element type class to interrogate.</param>
        /// <param name="type">Candidate <see cref="System.Type"/> for comparison</param>
        /// <returns>True if <see cref="TSqlModelElement"/> implement or extend the type <paramref name="type"/>.</returns>		
        public static bool ImplementsType(ModelTypeClass typeClass, Type type)
        {
            if(typeClass == null)
            {
                throw new ArgumentNullException("typeClass");
            }
            else if(type == null)
            {
                throw new ArgumentNullException("type");
            }

            switch(typeClass.Name)
            {
            case "Column":
                if (typeof(TSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlColumn).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableValuedFunction":
                if (typeof(TSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableValuedFunction).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlColumnSource).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "ApplicationRole":
                if (typeof(TSqlApplicationRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlApplicationRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlApplicationRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlApplicationRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlApplicationRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlApplicationRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlDatabaseSecurityPrincipal).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Index":
                if (typeof(TSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesStorage).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Assembly":
                if (typeof(TSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlAssembly).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "AsymmetricKey":
                if (typeof(TSqlAsymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlAsymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlAsymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlAsymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlAsymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Certificate":
                if (typeof(TSqlCertificate).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlCertificate).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlCertificate).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlCertificate).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlCertificate).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "CheckConstraint":
                if (typeof(TSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IExtendedPropertyHost).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "ColumnStoreIndex":
                if (typeof(TSqlColumnStoreIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlColumnStoreIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlColumnStoreIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlColumnStoreIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Contract":
                if (typeof(TSqlContract).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlContract).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlContract).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlContract).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlContract).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "DatabaseMirroringLanguageSpecifier":
                if (typeof(TSqlDatabaseMirroringLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlDatabaseMirroringLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlDatabaseMirroringLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlDatabaseMirroringLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlDatabaseMirroringLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IEndpointLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "DatabaseOptions":
                if (typeof(TSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlDatabaseOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Default":
                if (typeof(TSqlDefault).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlDefault).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlDefault).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlDefault).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlDefault).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlDefault).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "DefaultConstraint":
                if (typeof(TSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IExtendedPropertyHost).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Endpoint":
                if (typeof(TSqlEndpoint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlEndpoint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlEndpoint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlEndpoint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlEndpoint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "ForeignKeyConstraint":
                if (typeof(TSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlForeignKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IExtendedPropertyHost).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "FullTextCatalog":
                if (typeof(TSqlFullTextCatalog).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlFullTextCatalog).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlFullTextCatalog).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlFullTextCatalog).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlFullTextCatalog).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlFullTextCatalog).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "FullTextStopList":
                if (typeof(TSqlFullTextStopList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlFullTextStopList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlFullTextStopList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlFullTextStopList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlFullTextStopList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "HttpProtocolSpecifier":
                if (typeof(TSqlHttpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlHttpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlHttpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "MessageType":
                if (typeof(TSqlMessageType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlMessageType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlMessageType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlMessageType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlMessageType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "PrimaryKeyConstraint":
                if (typeof(TSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlPrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IExtendedPropertyHost).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesStorage).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Queue":
                if (typeof(TSqlQueue).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlQueue).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlQueue).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlQueue).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlQueue).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlColumnSource).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "RemoteServiceBinding":
                if (typeof(TSqlRemoteServiceBinding).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlRemoteServiceBinding).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlRemoteServiceBinding).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlRemoteServiceBinding).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlRemoteServiceBinding).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Role":
                if (typeof(TSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlRole).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlDatabaseSecurityPrincipal).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Route":
                if (typeof(TSqlRoute).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlRoute).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlRoute).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlRoute).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlRoute).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Schema":
                if (typeof(TSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlSchema).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "SearchPropertyList":
                if (typeof(TSqlSearchPropertyList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlSearchPropertyList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlSearchPropertyList).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "ServerOptions":
                if (typeof(TSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlServerOptions).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Service":
                if (typeof(TSqlService).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlService).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlService).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlService).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlService).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "ServiceBrokerLanguageSpecifier":
                if (typeof(TSqlServiceBrokerLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlServiceBrokerLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlServiceBrokerLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlServiceBrokerLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlServiceBrokerLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IEndpointLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "SoapLanguageSpecifier":
                if (typeof(TSqlSoapLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlSoapLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlSoapLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IEndpointLanguageSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "SpatialIndex":
                if (typeof(TSqlSpatialIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlSpatialIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlSpatialIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlSpatialIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlSpatialIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlSpatialIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "SymmetricKey":
                if (typeof(TSqlSymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlSymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlSymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlSymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlSymmetricKey).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "Table":
                if (typeof(TSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlColumnSource).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesStorage).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "FileTable":
                if (typeof(TSqlFileTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlFileTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlFileTable).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlColumnSource).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesStorage).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableType":
                if (typeof(TSqlTableType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTableType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTableType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTableType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableTypeCheckConstraint":
                if (typeof(TSqlTableTypeCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTableTypeCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTableTypeCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTableTypeCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableTypeCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableTypeCheckConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ITableTypeConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableTypeDefaultConstraint":
                if (typeof(TSqlTableTypeDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTableTypeDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTableTypeDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTableTypeDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableTypeDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableTypeDefaultConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ITableTypeConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableTypeIndex":
                if (typeof(TSqlTableTypeIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableTypeIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableTypeIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableTypePrimaryKeyConstraint":
                if (typeof(TSqlTableTypePrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTableTypePrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTableTypePrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTableTypePrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableTypePrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableTypePrimaryKeyConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ITableTypeConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TableTypeUniqueConstraint":
                if (typeof(TSqlTableTypeUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTableTypeUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlTableTypeUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTableTypeUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTableTypeUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlTableTypeUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ITableTypeConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "TcpProtocolSpecifier":
                if (typeof(TSqlTcpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlTcpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlTcpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlTcpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlTcpProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IProtocolSpecifier).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "UniqueConstraint":
                if (typeof(TSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlUniqueConstraint).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(IExtendedPropertyHost).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesStorage).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "User":
                if (typeof(TSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlUser).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlDatabaseSecurityPrincipal).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "UserDefinedType":
                if (typeof(TSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlUserDefinedType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "View":
                if (typeof(TSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureTSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlView).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlColumnSource).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISpecifiesIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "XmlIndex":
                if (typeof(TSqlXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "SelectiveXmlIndex":
                if (typeof(TSqlSelectiveXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlSelectiveXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlSelectiveXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlSelectiveXmlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlIndex).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "PromotedNodePathForXQueryType":
                if (typeof(TSqlPromotedNodePathForXQueryType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlPromotedNodePathForXQueryType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlPromotedNodePathForXQueryType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlPromotedNodePathForXQueryType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlPromotedNodePath).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "PromotedNodePathForSqlType":
                if (typeof(TSqlPromotedNodePathForSqlType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlPromotedNodePathForSqlType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlPromotedNodePathForSqlType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlPromotedNodePathForSqlType).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlPromotedNodePath).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            case "XmlSchemaCollection":
                if (typeof(TSqlXmlSchemaCollection).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql90TSqlXmlSchemaCollection).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql100TSqlXmlSchemaCollection).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql110TSqlXmlSchemaCollection).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISql120TSqlXmlSchemaCollection).IsAssignableFrom(type))
                {
                    return true;
                }
                else if (typeof(ISqlAzureV12TSqlXmlSchemaCollection).IsAssignableFrom(type))
                {
                    return true;
                }
                else if(typeof(ISqlSecurable).IsAssignableFrom(type))
                {
                    return true;
                }
                // no interfaces mapped.
                return false;
            }
            // no type mapping found
            return false;
        }
 public virtual bool Matches(ObjectIdentifier name, ModelTypeClass objectType, DeploymentStep step = null)
 {
     return(false);
 }
Beispiel #10
0
 private void DisplayTopLevelNode(string description, ModelTypeClass type)
 {
     DisplayTopLevelNode(TreeView, description, type);
 }
 private static string GetBaseInterfaceName(ModelTypeClass type, SqlServerVersion version)
 {
     return(GetInterfacePrefix(version) + DacUtilities.ClassNamePrefix + type.Name);
 }
 public override bool Matches(ObjectIdentifier name, ModelTypeClass type, DeploymentStep step = null)
 {
     return(Matches(name.GetSchemaName(type)));
 }
        public override bool Matches(ObjectIdentifier name, ModelTypeClass type, DeploymentStep step = null)
        {
            var objectName = name.Parts.LastOrDefault();

            return(!String.IsNullOrEmpty(objectName) && (Matches(objectName)));
        }
Beispiel #14
0
 private void DisplayTopLevelNode(string description, ModelTypeClass type)
 {
     DisplayTopLevelNode(TreeView, description, type);
 }
Beispiel #15
0
        private void DisplayTopLevelNode(ItemsControl rootNode, string header, ModelTypeClass type)
        {
            var newNode = new TreeViewItem {Header = header, Foreground = _defaultForeground};

            var objects = _model.GetObjects(DacQueryScopes.All, type);

            foreach (var child in objects)
            {
                var childTreeNode = AddTreeItem(child.Name.ToString(), newNode, _defaultForeground);
                DisplayObject(header, child, childTreeNode);
            }

            if (newNode.Items.Count > 0)
                rootNode.Items.Add(newNode);
        }
 public NameFindingVisitor(TSqlObject owningObject)
 {
     _currentTypeClass = owningObject.ObjectType;
     _typeClassToFragmentType.TryGetValue(_currentTypeClass, out _validTypes);
 }
 private static string GetReferenceInterfaceName(ModelTypeClass type, SqlServerVersion version)
 {
     return($"{GetBaseInterfaceName(type, version)}Reference");
 }
Beispiel #18
0
 //get the schema - basically it needs to have at least two parts, maybe return enum
 public static string GetSchemaName(this ObjectIdentifier src, ModelTypeClass type)
 {
     return(type == ModelSchema.Schema ? src.Parts.Last() : src.Parts.Count > 1 ? src.Parts[src.Parts.Count - (type == ModelSchema.Index ? 3 : 2)] : null);
 }
 private static void WriteInterfaceDeclaration(FormattedTextWriter writer, SqlServerVersion version, ModelTypeClass type, string interfaceName, Element element)
 {
     writer.WriteLine();
     writer.WriteLine($"public interface {interfaceName} : {DacUtilities.BaseModelInterfaceFullName}");
     using (writer.StartBlock())
     {
         foreach (ModelPropertyClass property in GetProperties(type))
         {
             if (!DacUtilities.SupportsVersion(property.SupportedPlatforms, version))
             {
                 continue;
             }
             bool   useGenericGetter;
             string typeName     = GetPropertyTypeName(property.DataType, out useGenericGetter);
             string propertyName = GetPropertyName(property, element);
             writer.WriteLine();
             writer.WriteLine($"{typeName} {propertyName} {{ get; }}");
         }
     }
 }
 private static List <ModelPropertyClass> GetProperties(ModelTypeClass type) =>
 new List <ModelPropertyClass>(type.Properties.OrderBy(t => t.Name));
 public NameFindingVisitor(TSqlObject owningObject)
 {
     _currentTypeClass = owningObject.ObjectType;
     _typeClassToFragmentType.TryGetValue(_currentTypeClass, out _validTypes);
 }
        public override bool Matches(ObjectIdentifier name, ModelTypeClass objectType, DeploymentStep step = null)
        {
            if (step == null)
            {
                return(false);
            }

            if (_operation != FilterOperation.Keep)
            {
                return(false);
            }

            if (!Matches(name.Parts.LastOrDefault()))
            {
                return(false);
            }

            if (step is SqlTableMigrationStep)
            {
                return(true);   //we can't allow a table migration on this table as it would drop our extra columns....
            }

            var alterStep = step as AlterElementStep;

            if (alterStep == null)
            {
                return(false);
            }

            var script = (TSqlScript)alterStep.Script;

            if (script == null)
            {
                return(false);
            }

            var batch = script.Batches.FirstOrDefault();

            if (batch == null)
            {
                return(false);
            }

            //is there a create table statement for our table? if so abort the whole thing

            var statement = batch.Statements.FirstOrDefault();

            var dropTableElementStatement = statement as AlterTableDropTableElementStatement;

            if (dropTableElementStatement == null)
            {
                return(false);
            }

            var toRemove = dropTableElementStatement.AlterTableDropTableElements.Where(p => p.TableElementType == TableElementType.Column).ToList();

            foreach (var alterTableDropTableElement in toRemove)
            {
                dropTableElementStatement.AlterTableDropTableElements.Remove(alterTableDropTableElement);
            }

            if (dropTableElementStatement.AlterTableDropTableElements.Count > 0)
            {
                return(false);
            }  //This is a strange one, we remove the bits we want from the drop table element but there might be other things like constraints that should be dropped

            script.Batches.RemoveAt(0);

            return(script.Batches.Count == 0);
        }