public static DbConnection EntityConnection(string conectar, string connectionString) { DbConnection dbConnection; switch (conectar) { case "VFP": connectionString = connectionString.Replace(""", "\""); dbConnection = new VfpConnection(connectionString); break; case "MSSQL": dbConnection = new SqlConnection(connectionString); break; /*case "MYSQL": * dbConnection = new MySqlConnection(connectionString); * break; * case "POSTGRESQL": * dbConnection = new NpgsqlConnection(connectionString); * break; * case "SQLITE": * dbConnection = new SQLiteConnection(connectionString); * break;*/ default: dbConnection = new SqlConnection(""); break; } return(dbConnection); }
public override DataTable GetSchema(VfpConnection connection) { ArgumentUtility.CheckNotNull("connection", connection); var dataTable = new DataTable(this.Key); dataTable.Columns.Add("Id"); dataTable.Columns.Add("CatalogName"); dataTable.Columns.Add("SchemaName"); dataTable.Columns.Add("Name"); dataTable.Columns.Add("ReturnTypeName"); dataTable.Columns.Add("ReturnMaxLength"); dataTable.Columns.Add("ReturnPrecision", typeof(int)); dataTable.Columns.Add("ReturnDateTimePrecision", typeof(int)); dataTable.Columns.Add("ReturnScale", typeof(int)); dataTable.Columns.Add("ReturnCollationCatalog"); dataTable.Columns.Add("ReturnCollationSchema"); dataTable.Columns.Add("ReturnCollationName"); dataTable.Columns.Add("ReturnCharacterSetCatalog"); dataTable.Columns.Add("ReturnCharacterSetSchema"); dataTable.Columns.Add("ReturnCharacterSetName"); dataTable.Columns.Add("ReturnIsMultiSet", typeof(bool)); dataTable.Columns.Add("IsAggregate", typeof(bool)); dataTable.Columns.Add("IsBuiltIn", typeof(bool)); dataTable.Columns.Add("IsNiladic", typeof(bool)); dataTable.Columns.Add("IsTvf", typeof(bool)); return(dataTable); }
public void PackTest() { var dbc = CreateTempDbc(); var builder = new VfpConnectionStringBuilder(dbc); builder.Deleted = false; using (var connection = new VfpConnection(builder.ConnectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "select count(*) from temp"; Assert.Equal(13, Convert.ToInt32(command.ExecuteScalar())); command.CommandText = "delete from temp where upper(allt(TableName)) == 'CUSTOMERS'"; command.ExecuteNonQuery(); command.CommandText = "select count(*) from temp"; Assert.Equal(13, Convert.ToInt32(command.ExecuteScalar())); connection.Pack("temp"); command.CommandText = "select count(*) from temp"; Assert.Equal(12, Convert.ToInt32(command.ExecuteScalar())); } connection.Close(); } }
public override DataTable GetSchema(VfpConnection connection, string[] restrictionValues) { ArgumentUtility.CheckNotNull("connection", connection); var schema = connection.GetSchema(VfpConnection.SchemaNames.Indexes, restrictionValues); schema.DefaultView.RowFilter = Index.Candidate + " = true"; schema = schema.DefaultView.ToTable(Name, true, CandidateKey.TableName, CandidateKey.IndexName, CandidateKey.FieldName); schema.TableName = Name; if (schema.Rows.Count == 0 || !ShouldExcludeTablesWithMultipleCandidateKeys(restrictionValues)) { return(schema); } var duplicates = schema.AsEnumerable() .Select(x => x.Field <string>(CandidateKey.TableName)) .GroupBy(x => x) .Where(x => x.Count() > 1) .Select(x => x.Key) .Distinct() .ToList(); var query = schema.AsEnumerable().Where(x => !duplicates.Contains(x.Field <string>(CandidateKey.TableName))); if (query.Any()) { schema = query.CopyToDataTable(); } return(schema); }
public override DataTable GetSchema(VfpConnection connection) { ArgumentUtility.CheckNotNull("connection", connection); var dataTable = new DataTable(Key); dataTable.Columns.Add(Columns.Id); dataTable.Columns.Add(Columns.ParentId); dataTable.Columns.Add(Columns.Name); dataTable.Columns.Add(Columns.ConstraintType); dataTable.Columns.Add(Columns.IsDeferrable, typeof(bool), "false"); dataTable.Columns.Add(Columns.IsInitiallyDeferred, typeof(bool), "false"); if (connection.IsDbc) { AddDbcPrimaryKeys(connection, dataTable); AddDbcForeignKeys(connection, dataTable); } else { AddFreeTablePrimaryKeys(connection, dataTable); } // Call distinct to remove duplicate rows caused by composite primary keys return(dataTable.DefaultView.ToTable(true)); }
public override DataTable GetSchema(VfpConnection connection) { ArgumentUtility.CheckNotNull("connection", connection); var dataTable = connection.GetSchema(Key); if (dataTable.Rows.Count > 0) { // remove referential integrity procedures var rows = dataTable.AsEnumerable() .Where(row => !row.Field <bool>(VfpConnection.SchemaColumnNames.Procedure.ReferentialIntegrity)) .ToArray(); if (rows.Any()) { dataTable = rows.CopyToDataTable(); } else { dataTable.Clear(); } } dataTable.Columns[VfpConnection.SchemaColumnNames.Procedure.ProcedureName].ColumnName = Columns.Id; dataTable.Columns.Add(Columns.Name, typeof(string), Columns.Id); dataTable.Columns.Add(Columns.CatalogName); dataTable.Columns.Add(Columns.SchemaName); RemoveColumnsWithUpperCaseNames(dataTable); dataTable = dataTable.DefaultView.ToTable(dataTable.TableName, false, new[] { "Id", "Name", "CatalogName", "SchemaName" }); dataTable.TableName = Key; return(dataTable); }
private void OKButton_Click(object sender, RoutedEventArgs e) { try { using (var connection = new VfpConnection(txtDataPath.Text)) { connection.Open(); connection.Close(); } } catch (Exception) { MessageBox.Show("Invalid connection string.", Title, MessageBoxButton.OK, MessageBoxImage.Error); e.Handled = true; } if (e.Handled) { return; } _connectionInfo.DynamicSchemaOptions.NoPluralization = !Pluralization.IsChecked.Value; _connectionInfo.DynamicSchemaOptions.NoCapitalization = !Capitalize.IsChecked.Value; var singularizeElement = _connectionInfo.DriverData.Element("Singularize"); if (singularizeElement == null) { _connectionInfo.DriverData.Add(new XElement("Singularize", Singularize.IsChecked.Value)); } else { singularizeElement.Value = Singularize.IsChecked.Value.ToString(); } DialogResult = true; }
public override DataTable GetSchema(VfpConnection connection, string[] restrictionValues) { ArgumentUtility.CheckNotNull("connection", connection); var dataTable = new DataTable(Name); #region columns dataTable.Columns.Add(DataSourceInformation.CompositeIdentifierSeparatorPattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.DataSourceProductName, typeof(string)); dataTable.Columns.Add(DataSourceInformation.DataSourceProductVersion, typeof(string)); dataTable.Columns.Add(DataSourceInformation.DataSourceProductVersionNormalized, typeof(string)); dataTable.Columns.Add(DataSourceInformation.GroupByBehavior, typeof(GroupByBehavior)); dataTable.Columns.Add(DataSourceInformation.IdentifierPattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.IdentifierCase, typeof(IdentifierCase)); dataTable.Columns.Add(DataSourceInformation.OrderByColumnsInSelect, typeof(bool)); dataTable.Columns.Add(DataSourceInformation.ParameterMarkerFormat, typeof(string)); dataTable.Columns.Add(DataSourceInformation.ParameterMarkerPattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.ParameterNameMaxLength, typeof(int)); dataTable.Columns.Add(DataSourceInformation.ParameterNamePattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.QuotedIdentifierPattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.QuotedIdentifierCase, typeof(IdentifierCase)); dataTable.Columns.Add(DataSourceInformation.StatementSeparatorPattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.StringLiteralPattern, typeof(string)); dataTable.Columns.Add(DataSourceInformation.SupportedJoinOperators, typeof(SupportedJoinOperators)); #endregion columns #region rows DataRow row; #region row 0 row = dataTable.NewRow(); row[DataSourceInformation.CompositeIdentifierSeparatorPattern] = "!"; row[DataSourceInformation.DataSourceProductName] = "Microsoft Visual FoxPro"; row[DataSourceInformation.DataSourceProductVersion] = "09.00.0000.5815"; row[DataSourceInformation.DataSourceProductVersionNormalized] = "09.00.0000.5815"; row[DataSourceInformation.GroupByBehavior] = 3; row[DataSourceInformation.IdentifierPattern] = "[^0123456789 !\"#\\$%&'\\(\\)\\*\\+,-\\./:;<=>\\?@\\[\\\\\\]\\^`\\{\\|}~][^ !\"#\\$%&'\\(\\)\\*\\+,-\\./:;<=>\\?@\\[\\\\\\]\\^`\\{\\|}~]*"; row[DataSourceInformation.IdentifierCase] = 1; row[DataSourceInformation.OrderByColumnsInSelect] = false; row[DataSourceInformation.ParameterMarkerFormat] = "{0}"; row[DataSourceInformation.ParameterMarkerPattern] = @"@[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)"; row[DataSourceInformation.ParameterNameMaxLength] = 128; row[DataSourceInformation.ParameterNamePattern] = @"^[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)"; row[DataSourceInformation.QuotedIdentifierPattern] = "`(([^`]|``)*)`"; row[DataSourceInformation.QuotedIdentifierCase] = 1; row[DataSourceInformation.StatementSeparatorPattern] = DBNull.Value; row[DataSourceInformation.StringLiteralPattern] = DBNull.Value; row[DataSourceInformation.SupportedJoinOperators] = DBNull.Value; dataTable.Rows.Add(row); #endregion row #endregion rows return(dataTable); }
public override DataTable GetSchema(VfpConnection connection) { ArgumentUtility.CheckNotNull("connection", connection); var dataTable = new DataTable(Key); dataTable.Columns.Add("ConstraintId"); dataTable.Columns.Add("ColumnId"); if (!_isView) { if (connection.IsDbc) { AddDbcPrimaryKeys(connection, dataTable); AddDbcForeignKeys(connection, dataTable); } else { AddFreeTablePrimaryKeys(connection, dataTable); } } dataTable.DefaultView.ToTable(dataTable.TableName, true); return(dataTable); }
public override DataTable GetSchema(VfpConnection connection) { ArgumentUtility.CheckNotNull("connection", connection); var dataTable = new DataTable(Key); dataTable.Columns.Add("Id"); dataTable.Columns.Add("ParentId"); dataTable.Columns.Add("Name"); dataTable.Columns.Add("Ordinal", typeof(int)); dataTable.Columns.Add("TypeName"); dataTable.Columns.Add("MaxLength"); dataTable.Columns.Add("Precision", typeof(int)); dataTable.Columns.Add("DateTimePrecision", typeof(int)); dataTable.Columns.Add("Scale", typeof(int)); dataTable.Columns.Add("CollationCatalog"); dataTable.Columns.Add("CollationSchema"); dataTable.Columns.Add("CollationName"); dataTable.Columns.Add("CharacterSetCatalog"); dataTable.Columns.Add("CharacterSetSchema"); dataTable.Columns.Add("CharacterSetName"); dataTable.Columns.Add("IsMultiSet", typeof(bool)); dataTable.Columns.Add("Mode"); dataTable.Columns.Add("Default"); return(dataTable); }
private DataTable RemoveReferentialIntegrityProcedures(VfpConnection connection, DataTable dataTable) { if (dataTable == null || dataTable.Rows.Count == 0) { return(dataTable); } var procedureSchema = new ProcedureSchema(); var procedures = procedureSchema.GetSchema(connection); var procedureNames = procedures.AsEnumerable() .Select(row => row.Field <string>(ProcedureSchema.Columns.Name)) .ToList(); var query = dataTable.AsEnumerable() .Where(row => procedureNames.Contains(row.Field <string>(VfpClientProcedureParameterSchema.ProcedureName))); if (query.Any()) { dataTable = query.CopyToDataTable(); } else { dataTable.Clear(); } return(dataTable); }
public static void ClassInitialize(TestContext testContext) { var connectionString = Path.Combine(GetTestDeploymentDir(testContext), @"CodeFirstData\CodeFirst.dbc"); var connection = new VfpConnection(connectionString); var context = new CodeFirstContext(connection); context.Artists.ToList(); }
public VfpConnection CreateConnection() { var connection = new VfpConnection(this.GetConnectionString()); connection.Open(); return(connection); }
public VfpQueryProvider New(VfpConnection connection) { var provider = New(connection, Mapping, Policy as VfpQueryPolicy); provider.Log = Log; return(provider); }
private new VfpConnection GetConnection() { var connection = new VfpConnection(Path.Combine(TestContext.TestDeploymentDir, @"AllTypes\AllTypes.dbc")); EnableTracing(connection); return(connection); }
private void LoadViewFieldData(VfpConnection connection, string[] restrictionValues, DataTable schema) { if (!connection.IsDbc) { return; } var viewName = restrictionValues == null || restrictionValues.Length < 1 ? null : restrictionValues[0]; var fieldName = restrictionValues == null || restrictionValues.Length < 2 ? null : restrictionValues[1]; var viewsSchema = connection.OleDbConnection.GetSchema("Views", new[] { null, null, viewName }); if (viewsSchema.Rows.Count == 0) { return; } var props = GetProps(connection, viewsSchema).AsEnumerable().ToList(); var propColumns = Columns.Where(x => x.UseGetDbProp).ToArray(); foreach (DataRow row in viewsSchema.Rows) { var schemaViewName = row.Field <string>("TABLE_NAME"); var oleDbColumnSchema = connection.OleDbConnection.GetSchema("Columns", new[] { null, null, schemaViewName, fieldName }); foreach (DataRow fieldRow in oleDbColumnSchema.Rows) { var schemaFieldName = fieldRow.Field <string>("COLUMN_NAME"); if (fieldName != null && !fieldName.Equals(schemaFieldName, StringComparison.OrdinalIgnoreCase)) { continue; } var propRow = props.Single(x => x.Field <string>(ViewField.ViewName).Equals(schemaViewName, StringComparison.OrdinalIgnoreCase) && x.Field <string>(ViewField.FieldName).Equals(schemaFieldName, StringComparison.OrdinalIgnoreCase)); var schemaRow = schema.NewRow(); schemaRow[ViewField.FieldName] = fieldRow["COLUMN_NAME"]; schemaRow[ViewField.ViewName] = fieldRow["TABLE_NAME"]; schemaRow[ViewField.Ordinal] = fieldRow["ORDINAL_POSITION"]; schemaRow[ViewField.Nullable] = fieldRow["IS_NULLABLE"]; FillDataTypeWidthDecimalColumn(schemaRow, propRow.Field <string>("DataType")); propColumns.ForEach(x => schemaRow[x.Name] = propRow[x.Name]); var vfpType = (VfpType)schemaRow[ViewField.VfpType]; var propVfpType = propRow.Field <string>("FieldType").ToVfpType(); if (!vfpType.IsStringType() && propVfpType.IsStringType()) { schemaRow[ViewField.VfpType] = propVfpType; } schema.Rows.Add(schemaRow); } } }
protected DbcCreatorBase(string dbcPath, ITableConverter <T> tableConverter, IDbcFilesProvider dbcFilesProvider) { DbcPath = ArgumentUtility.CheckNotNullOrEmpty("dbcPath", dbcPath); _tableConverter = ArgumentUtility.CheckNotNull("tableConverter", tableConverter); _dbcFilesProvider = ArgumentUtility.CheckNotNull("dbcFilesProvider", dbcFilesProvider); CreateDbc(dbcFilesProvider); _connection = new VfpConnection("provider=vfpoledb;exclusive=off;OLE DB Services=0;data source=" + DbcPath); }
protected CodeFirstContext GetCodeFirstContext() { var connectionString = Path.Combine(GetTestDeploymentDir(TestContext), @"CodeFirstData\CodeFirst.dbc"); var connection = new VfpConnection(connectionString); EnableTracing(connection); return(new CodeFirstContext(connection)); }
protected virtual VfpConnection GetConnection() { var connectionString = Path.Combine(GetTestDeploymentDir(TestContext), "northwind.dbc"); var connection = new VfpConnection(connectionString); EnableTracing(connection); return(connection); }
protected override VfpConnection GetConnection() { var connectionString = Path.Combine(GetTestDeploymentDir(TestContext), "FreeTables"); var connection = new VfpConnection(connectionString); connection.Open(); return(connection); }
private AutoGenDataContext GetAutoGenDataContext() { var connectionString = Path.Combine(GetTestDeploymentDir(TestContext), @"AutoGenId\Data"); var connection = new VfpConnection(connectionString); EnableTracing(connection); return(new AutoGenDataContext(connection)); }
protected void EnableTracing(VfpConnection connection) { if (Debugger.IsAttached) { return; } connection.CommandExecuting = details => TestContext.WriteLine(GetExecutionDetails(details)); connection.CommandFailed = details => TestContext.WriteLine(GetExecutionDetails(details)); connection.CommandFinished = details => TestContext.WriteLine(GetExecutionDetails(details)); }
public override DataTable GetSchema(VfpConnection connection) { ArgumentUtility.CheckNotNull("connection", connection); //// TODO: consider getting this information later... by using AFields() var dataTable = new DataTable(this.Key); dataTable.Columns.Add("Id"); dataTable.Columns.Add("Expression"); return(dataTable); }
public static void Using(string connectionString, Action <SchemaManager> action) { var builder = new VfpConnectionStringBuilder(connectionString); builder.Ansi = true; var connection = new VfpConnection(builder.ConnectionString); using (var manager = new SchemaManager(connection, new DataTableDbcCreator())) { action(manager); }; }
private static void UpdateAutoIncAndCandidate(VfpConnection connection, DataTable schema) { var tableNames = schema.AsEnumerable().Select(x => x.Field <string>(Index.TableName)).Distinct(); var inserts = string.Join(Environment.NewLine, tableNames.Select(x => string.Format("INSERT INTO curTables VALUES('{0}')", x)).ToArray()); var vfpCode = string.Format(Resources.IndexSchemaAutoIncCandidate, inserts); schema.AsEnumerable().ToList().ForEach(row => { row[Index.AutoInc] = false; row[Index.Candidate] = false; }); connection.ExecuteScript(vfpCode); using (var command = connection.CreateCommand()) { command.CommandType = CommandType.Text; command.CommandText = "SELECT * FROM curOutput"; #if DEBUG var dt = new DataTable(); var da = new VfpDataAdapter(command); da.Fill(dt); #endif using (var reader = command.ExecuteReader()) { while (reader.Read()) { var tableName = reader.GetString(0); var fieldName = reader.GetString(1); var isAutoInc = !string.IsNullOrEmpty(fieldName); var indexName = reader.GetString(2); var rows = schema.AsEnumerable().Where(x => x.Field <string>(Index.TableName) == tableName); if (string.IsNullOrEmpty(fieldName)) { rows = rows.Where(x => x.Field <string>(Index.IndexName).ToUpper() == indexName); } else { rows = rows.Where(x => x.Field <string>(Index.FieldName).ToUpper() == fieldName); } rows.ToList().ForEach(row => { row[Index.AutoInc] = isAutoInc; row[Index.Candidate] = !isAutoInc; }); } } command.CommandText = "USE"; command.ExecuteNonQuery(); } }
public override DataTable GetSchema(VfpConnection connection, string[] restrictionValues) { ArgumentUtility.CheckNotNull("connection", connection); var foreignKeys = connection.OleDbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Foreign_Keys, null); ModifyColumns(foreignKeys); if (!connection.IsDbc || foreignKeys.Rows.Count == 0) { return(foreignKeys); } // using indexes just so that the restrictionValues can be applied to the foreignKeys var indexes = connection.GetSchema(VfpConnection.SchemaNames.Indexes, restrictionValues); if (indexes.Rows.Count == 0) { return(foreignKeys); } var query = from foreignKey in foreignKeys.AsEnumerable() from index in indexes.AsEnumerable() where foreignKey.Field <string>(ForeignKey.ForeignKeyIndexName).Equals(index.Field <string>(Index.IndexName), StringComparison.InvariantCultureIgnoreCase) && foreignKey.Field <string>(ForeignKey.ForeignKeyTableName).Equals(index.Field <string>(Index.TableName), StringComparison.InvariantCultureIgnoreCase) && foreignKey.Field <string>(ForeignKey.ForeignKeyFieldName).Equals(index.Field <string>(Index.FieldName), StringComparison.InvariantCultureIgnoreCase) select foreignKey; if (!query.Any()) { foreignKeys.Clear(); return(foreignKeys); } var schema = query.CopyToDataTable(); schema.TableName = Name; FormatColumnValues(schema, new[] { ForeignKey.ForeignKeyTableName, ForeignKey.ForeignKeyFieldName, ForeignKey.ForeignKeyIndexName, ForeignKey.PrimaryKeyTableName, ForeignKey.PrimaryKeyFieldName, ForeignKey.PrimaryKeyIndexName }); return(schema); }
public void CreateTempTable(VfpConnection connection, DataTableDbcCreator dbcCreator) { ArgumentUtility.CheckNotNull("connection", connection); DataTable dataTable = null; connection.DoConnected(() => { dataTable = this.GetSchema(connection); }); dbcCreator.Add(dataTable); TempTableFullPath = dataTable.TableName; }
private static void AddDbcPrimaryKeys(VfpConnection connection, DataTable dataTable) { var primarykeys = connection.GetSchema(VfpConnection.SchemaNames.PrimaryKeys); foreach (DataRow dataRow in primarykeys.Rows) { DataRow newRow = dataTable.NewRow(); newRow[Columns.Id] = dataRow[PrimaryKeySchema.IndexName]; newRow[Columns.ParentId] = dataRow[PrimaryKeySchema.TableName]; newRow[Columns.Name] = newRow[Columns.Id]; newRow[Columns.ConstraintType] = ConstraintTypes.PrimaryKey; dataTable.Rows.Add(newRow); } }
public override DataTable GetSchema(VfpConnection connection, string[] restrictionValues) { ArgumentUtility.CheckNotNull("connection", connection); var schema = CreateSchemaStructure(); LoadViewFieldData(connection, restrictionValues, schema); schema.Columns["DataType"].ColumnName = ViewField.VfpTypeName; FormatColumnValues(schema, new[] { ViewField.ViewName, ViewField.FieldName }); return(schema); }
public VfpCommand(string commandText = null, VfpConnection connection = null, VfpTransaction transaction = null) { CommandText = commandText; if (connection != null) { Connection = connection; } if (transaction != null) { Transaction = transaction; } }
public static List<ExplorerItem> GetSchema(VfpConnection connection, IConnectionInfo connectionInfo) { if (connection == null) { throw new ArgumentNullException("connection"); } if (connectionInfo == null) { throw new ArgumentNullException("connectionInfo"); } var reader = new SchemaReader(connection, connectionInfo); var database = reader.GetDatabase(); return database.GetExplorerSchema(); }
public SchemaReader(VfpConnection connection, IConnectionInfo connectionInfo) { if (connection == null) { throw new ArgumentNullException("connection"); } if (connectionInfo == null) { throw new ArgumentNullException("connectionInfo"); } _connection = connection; _connectionInfo = connectionInfo; new VfpConnectionStringBuilder(_connection.ConnectionString); _singularize = GetSingularizeSetting(); _tableNames = GetTableNames(); _primaryKeys = GetPrimaryKeys(); }
public void CharByteArrayStringMappingTest() { File.WriteAllBytes("CharByteArrayData.zip", Properties.Resources.CharByteArrayDataZip); FastZip zip = new FastZip(); zip.ExtractZip("CharByteArrayData.zip", this.TestContext.TestDeploymentDir, string.Empty); string connectionString = @"Provider=VFPOLEDB;Data Source=" + this.TestContext.TestDeploymentDir; using (var connection = new VfpConnection(connectionString)) { var provider = new VfpQueryProvider(connection, VfpLanguage.Default, new VfpImplicitMapping(), VfpQueryPolicy.Default); provider.AutoRightTrimStrings = true; provider.Log = Console.Out; var table = provider.GetTable<MenuList>("MenuList"); var newItem = new MenuList { Menu_Name = "blah", Alt_Name = "blahAlt", MenuActive = "N", MenuListId = 99 }; table.Insert(newItem); var existingItem = table.Where(x => x.MenuListId == newItem.MenuListId).OrderBy(x => x.MenuListId).Single(); Assert.AreEqual(newItem.Alt_Name, existingItem.Alt_Name); Assert.AreEqual(newItem.Menu_Name, existingItem.Menu_Name); Assert.AreEqual(newItem.MenuActive, existingItem.MenuActive); Assert.AreEqual(newItem.MenuListId, existingItem.MenuListId); } }