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); } }
public NorthwindDataContext(IRepository repository) : base(repository) { if (repository is DbEntityRepository) { this.Provider = ((DbEntityRepository)repository).Provider as VfpQueryProvider; } }
public void DecimalReadExceptionTest() { var connectionString = this.TestContext.TestDeploymentDir + @"\Decimal"; using (VfpQueryProvider provider = VfpQueryProvider.Create(connectionString, null)) { var result = provider.GetTable <DecimalTable>("DecimalTable") .OrderBy(x => x.nValue) .Select(x => x.nValue) .First(); Assert.AreEqual(7654321.12345M, result); } }
private static DbEntityRepository CreateRepository(string connectionString) { VfpQueryProvider provider = VfpQueryProvider.Create(connectionString, null); Type type = typeof(NorthwindDataContext); // path of the xml file in the dll string xmlPath = Path.GetFileNameWithoutExtension(type.FullName) + ".Mapping.xml"; using (StreamReader streamReader = new StreamReader(type.Assembly.GetManifestResourceStream(xmlPath))) { provider = provider.New(VfpXmlMapping.FromXml(streamReader.ReadToEnd())); } return(new DbEntityRepository(provider)); }
public LinqToVfpDataContext(IRepository repository, TestContextWriter testContextWriter) : base(repository) { this.Provider = ((DbEntityRepository)repository).Provider as VfpQueryProvider; this.Provider.AutoRightTrimStrings = true; if (testContextWriter == null) { this.Provider.Log = new IQToolkitContrib.DebuggerWriter(); } else { this.Provider.Log = testContextWriter; } }
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); } }
public NorthwindSession(VfpQueryProvider provider) : base(provider) { }
public NorthwindContext(string connectionString, string mappingId) : base(VfpQueryProvider.Create(connectionString, mappingId)) { }
public NorthwindDataContext(VfpQueryProvider provider) { this.Provider = provider; }
public NorthwindDataContext(VfpQueryProvider provider) : this(new DbEntityRepository(provider)) { }
public NorthwindSession(VfpQueryProvider provider) : base(provider) { }
public DecimalDataContext(string connectionString) { var mappingId = typeof(DecimalDataContextAttributes).FullName; this.Provider = VfpQueryProvider.Create(connectionString, mappingId); }
public Context(string connectionString, string mappingId) : this(VfpQueryProvider.Create(connectionString, mappingId)) { }
public Context(VfpQueryProvider provider) : base(provider) { }