Пример #1
0
        public static void GenerateProxiesFromDb(string path, string @namespace, string connStr,
                                                 string prefix = null, bool includeTablesAndViews = true, bool includeUdtts = true, string schema = "dbo")
        {
            var sqlConnStr = new SqlConnectionString(connStr);

            sqlConnStr.GenerateProxiesFromDb(
                includeTablesAndViews ? sqlConnStr.GetDbObjectNames(TableType.TableOrView, prefix, schema) : null,
                includeUdtts ? sqlConnStr.GetDbObjectNames(TableType.Udtt, prefix, schema) : null,
                path, @namespace, schema
                );
        }
Пример #2
0
        public static void GenerateProxiesFromDb(string path, string @namespace, string connStr,
                                                 IEnumerable <string> tableNames = null, IEnumerable <string> udttNames = null, string schema = "dbo")
        {
            var sqlConnStr = new SqlConnectionString(connStr);

            sqlConnStr.GenerateProxiesFromDb(
                tableNames ?? sqlConnStr.GetDbObjectNames(TableType.TableOrView, null, schema),
                udttNames ?? sqlConnStr.GetDbObjectNames(TableType.Udtt, null, schema),
                path, @namespace, schema
                );
        }
Пример #3
0
        internal static IEnumerable <string> GetDbObjectNames(this SqlConnectionString sqlConnStr,
                                                              TableType type, string prefix = null, string schema = null)
        {
            var clause = "";

            if (!string.IsNullOrEmpty(prefix))
            {
                clause = string.Format(GetNamesClauses[type], prefix);
            }
            if (!string.IsNullOrEmpty(schema))
            {
                clause += string.Format(GetNamesSchemaClauses[type], schema);
            }
            var cmd = string.Format(GetNamesCommands[type], clause);

            return(sqlConnStr.GetDbObjectNames(cmd));
        }