public async void GenerateScriptAsync(SpreadSheetInfo spreadSheetInfo)
        {
            var result = await GetSheetService().Spreadsheets.Get(spreadSheetInfo.SpreadSheetId).ExecuteAsync();

            var eList = result.Sheets.Where(x => x.Properties.Title.Contains("[E]")).ToList();

            foreach (Sheet sheet in eList)
            {
                string range        = sheet.Properties.Title;
                var    resultValues = await GetSheetService().Spreadsheets.Values.Get(spreadSheetInfo.SpreadSheetId, range).ExecuteAsync();

                EditorUtility.DisplayProgressBar(sheet.Properties.Title, "", 0);
                IList <IList <object> > sheetValues = resultValues.Values;
                string logicalName  = sheetValues[1][2].ToString();
                string physicalName = sheetValues[2][2].ToString();
                List <TableDefinitionDataEntity> tableDefinitionDataEntities = ToEnumDataEntityList(sheetValues);
                TableDefinitionEntity            entity = new TableDefinitionEntity(SchemaType.Enumeration.ToString(), logicalName, physicalName, "", tableDefinitionDataEntities);
                TableDefinitionRepository.Instance.Insert(entity);
            }

            GenerateEnumScript();

            var tList = result.Sheets.Where(x => x.Properties.Title.Contains("[T]")).ToList();

            foreach (Sheet sheet in tList)
            {
                string range        = sheet.Properties.Title;
                var    resultValues = await GetSheetService().Spreadsheets.Values.Get(spreadSheetInfo.SpreadSheetId, range).ExecuteAsync();

                EditorUtility.DisplayProgressBar(sheet.Properties.Title, "", 0);
                IList <IList <object> > sheetValues = resultValues.Values;
                string schema               = sheetValues[0][2].ToString();
                string logicalName          = sheetValues[1][2].ToString();
                string physicalName         = sheetValues[2][2].ToString();
                string persistentObjectType = sheetValues[3][2].ToString();
                List <TableDefinitionDataEntity> tableDefinitionDataEntities = ToTableDefinitionDataEntityList(sheetValues);
                TableDefinitionEntity            entity = new TableDefinitionEntity(schema, logicalName, physicalName, persistentObjectType, tableDefinitionDataEntities);
                TableDefinitionRepository.Instance.Insert(entity);
            }

            GenerateTableDefinitionScript();

            EditorUtility.ClearProgressBar();
        }
        void GenerateEnumScript()
        {
            var list = TableDefinitionRepository.Instance.FindAllBy(x => x.SchemaType.IsEnumeration());

            for (var index = 0; index < list.Count; index++)
            {
                TableDefinitionEntity entity = list[index];

                float progress = (float)index / list.Count;
                EditorUtility.DisplayProgressBar("Generate Enumeration...", entity.PhysicalName, progress);

                string script       = entity.GenerateEnumScript();
                string enumFilePath = Path.Combine("Assets/App/Database/Enumerations", entity.GetEnumScriptFileName);
                ExIO.WriteAllText(enumFilePath, script);
                ExUnityEditor.AssetDataBaseRefresh();

                string[] labels = { entity.SchemaType.ToString() };
                AssetDatabase.SetLabels(AssetDatabase.LoadAssetAtPath <TextAsset>(enumFilePath), labels);
            }
        }
        void GenerateTableDefinitionScript()
        {
            List <TableDefinitionEntity> list = TableDefinitionRepository.Instance.FindAllBy(x => !x.SchemaType.IsEnumeration());

            for (var index = 0; index < list.Count; index++)
            {
                TableDefinitionEntity entity = list[index];

                float progress = (float)index / list.Count;
                EditorUtility.DisplayProgressBar("Generate TableDefinition...", entity.PhysicalName, progress);

                string entityScript   = entity.GenerateEntityScript();
                string entityFilePath = Path.Combine("Assets/App/Database", entity.SchemaType.ToString(), entity.GetEntityScriptFileName);
                ExIO.WriteAllText(entityFilePath, entityScript);

                string entityServiceScript   = entity.GenerateEntityServiceScript();
                string entityServiceFilePath = Path.Combine("Assets/App/Database/", entity.SchemaType.ToString(), entity.GetEntityServiceScriptFileName);
                if (!File.Exists(entityServiceFilePath))
                {
                    ExIO.WriteAllText(entityServiceFilePath, entityServiceScript);
                }

                string repositoryScript        = "";
                string repositoryServiceScript = "";
                string fileName        = "";
                string serviceFilePath = "";

                if (entity.PersistentObjectType.IsRepository())
                {
                    repositoryScript = entity.GenerateRepositoryScript();
                    fileName         = entity.GetRepositoryScriptFileName;

                    repositoryServiceScript = entity.GenerateRepositoryServiceScript();
                    serviceFilePath         = Path.Combine("Assets/App/Database/", entity.SchemaType.ToString(), entity.GetRepositoryServiceScriptFileName);
                }
                else if (entity.PersistentObjectType.IsDataMapper())
                {
                    repositoryScript = entity.GenerateDataMapperScript();
                    fileName         = entity.GetDataMapperScriptFileName;

                    repositoryServiceScript = entity.GenerateDataMapperServiceScript();
                    serviceFilePath         = Path.Combine("Assets/App/Database/", entity.SchemaType.ToString(), entity.GetDataMapperServiceScriptFileName);
                }

                string repositoryFilePath = Path.Combine("Assets/App/Database/", entity.SchemaType.ToString(), fileName);
                ExIO.WriteAllText(repositoryFilePath, repositoryScript);

                if (!File.Exists(serviceFilePath))
                {
                    ExIO.WriteAllText(serviceFilePath, repositoryServiceScript);
                }

                ExUnityEditor.AssetDataBaseRefresh();

                string[] entityLabels = { entity.SchemaType.ToString(), "Entity", "Database" };
                AssetDatabase.SetLabels(AssetDatabase.LoadAssetAtPath <TextAsset>(entityFilePath), entityLabels);

                string[] repositoryLabels = { entity.SchemaType.ToString(), entity.PersistentObjectType.ToString(), "Database" };
                AssetDatabase.SetLabels(AssetDatabase.LoadAssetAtPath <TextAsset>(repositoryFilePath), repositoryLabels);
            }
        }