Пример #1
0
        public void TableExistsTest()
        {
            Assert.IsFalse(gateway.IsTableExists(typeof(User)), "Table Exists test failed");

            gateway.CreateTable(typeof(User));
            Assert.IsTrue(gateway.IsTableExists(typeof(User)));
        }
Пример #2
0
        /// <summary>
        /// Exports the specified types.
        /// </summary>
        /// <param name="types">The types.</param>
        /// <param name="ExportWithClean">if set to <c>true</c> than all existsing data will be removed first.</param>
        public void Export(Type[] types, bool ExportWithClean)
        {
            string     methodName = ExportWithClean ? "ExportWithClean" : "Export";
            MethodInfo method     = GetType().GetMethod(methodName, new Type[] {});

            DbStructureGateway structureGateway = new DbStructureGateway(Source);

            foreach (Type type in types)
            {
                string tableName = DbAttributesManager.GetTableName(type);

                if (structureGateway.IsTableExists(tableName))
                {
                    method.MakeGenericMethod(type).Invoke(this, null);
                }
            }
        }