private DataObject GetDataObjectDetail(string dataObjectID)
        {
            var dataobject = new DataObjectManager().GetDataObject(dataObjectID);

            if (dataobject.DataSource == null)
            {
                var dataSource = DataSourceService.GetInstance().GetDataSource(dataobject.DataSourceName);
                if (dataSource != null)
                {
                    dataobject.DataSource = dataSource;
                }
            }
            if (!string.IsNullOrWhiteSpace(dataobject.TableShardingStrategyID))
            {
                var strategy = ShardingStrategyService.GetInstance().GetTableShardingStrategy(dataobject.TableShardingStrategyID);
                if (strategy != null)
                {
                    dataobject.TableShardingStrategy = strategy;
                    if (string.IsNullOrWhiteSpace(dataobject.ActualTableNames))
                    {
                        var tableNames = ShardingStrategyService.GetInstance().GetShardingTableNames(strategy, dataobject.LogicTableName);
                        if (tableNames != null && tableNames.Count > 0)
                        {
                            dataobject.ActualTableNames = string.Join(",", tableNames);
                        }
                    }
                }
            }

            return(dataobject);
        }
Пример #2
0
        public static DataSourceService GetInstance()
        {
            if (instance == null)
            {
                lock (syncObj)
                {
                    if (instance == null)
                    {
                        instance = new DataSourceService();
                    }
                }
            }

            return(instance);
        }