예제 #1
0
        /// <summary>
        /// Generates the table objects.
        /// </summary>
        /// <param name="data">The data context.</param>
        /// <returns>The code unit</returns>
        public CodeCompileUnit GenerateCode(ModelDataContextObjectContainer data)
        {
            _dataBase           = data.Database;
            _companyName        = data.NamespaceCompanyName;
            _databaseConnection = data.DatabaseConnection;
            _connectionType     = data.ConnectionType;
            _connectionDataType = data.ConnectionDataType;
            _contextName        = data.ContextName;
            _tableListExclusion = data.TableListExclusion;
            _dataBaseConnect    = data.DataBaseConnect;
            _dataBaseOwner      = data.DataBaseOwner;
            _extendedName       = data.NamespaceExtendedName;
            _dataContextName    = data.DataContextName;
            _dataAccessProvider = data.DataAccessProvider;
            _data = ConvertToUpperCase(data);

            // Create the namespace.
            InitialiseNamespace();
            InitialiseNamespaceExtended();

            // Get the database tables.
            if (GetDatabaseTables())
            {
                // Add the classes.
                AddClasses();
                AddClassesExtended();
            }

            // Return the complie unit.
            _targetUnit.Namespaces.Add(samples);
            _targetUnit.Namespaces.Add(samplesExtended);
            return(_targetUnit);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private ModelDataContextObjectContainer ConvertToUpperCase(ModelDataContextObjectContainer data)
        {
            ModelDataContextObjectContainer items = data;

            for (int i = 0; i < items.TableList.Count(); i++)
            {
                items.TableList[i] = items.TableList[i].ToUpper();
            }

            return(items);
        }