Exemplo n.º 1
0
        public ListAllTablesResponse ListAllTables(ListAllTablesRequest request)
        {
            ListAllTablesResponse response = new ListAllTablesResponse();

            string projectPath = ProjectBasePath + request.ProjectName;

            if (Directory.Exists(projectPath))
            {
                // Get connection string from Project's _Db.config file
                ProjectDomain projectDomain = ProjectDomainHelper.ToProjectDomain(File.ReadAllText(projectPath + "\\_Db.config"));

                DbTableDAL     tableDAL = new DbTableDAL(ProjectDomainHelper.ToConnectionString(projectDomain));
                List <DbTable> tables   = tableDAL.GetTables();
                response.Tables = new List <CommitItemDomain>();
                foreach (DbTable table in tables)
                {
                    CommitItemDomain item = new CommitItemDomain();
                    item.ItemType          = CommitItemDomain.ItemType_Table;
                    item.Name              = table.TABLE_NAME;
                    item.CurrentDefinition = table.Definition;
                    response.Tables.Add(item);
                }
            }
            else
            {
                response.StatusCode    = StatusCodes.Status_Error;
                response.StatusMessage = "Project not exists";
            }

            return(response);
        }
Exemplo n.º 2
0
        public void TestGetTablesByDatabase_Fusion()
        {
            dal = new DbTableDAL("Data Source=34.208.160.108;Initial Catalog=Fusion;Integrated Security=False;User Id=GitDB;Password=GitDBAdmin;MultipleActiveResultSets=True");
            List <DbTable> actual = dal.GetTables();

            Assert.IsNotNull(actual);
        }