This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am trying to connect to vistadb database and I am not able to is there a sample available |
|
|
We don't have a special sample for VistaDB, but here's how we set it up in our tests: LightSpeedContext context = new LightSpeedContext(); Then to use this configuration: using (IUnitOfWork unitOfWork = context.CreateUnitOfWork()) If this doesn't work for you then could you say a bit more about what kind of errors you are getting? Thanks! |
|
|
I created a project using Northwind on sql server 2005 it works I then used vistadb database migration to move the northwind db to vistadb gives me: Data Source=C:\temp\NorthWind.vdb3; I then use app config <connectionStrings>< add name="NwSql" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=NorthWind;Integrated Security=True;"/> <add name="nwVdb" connectionString="Data Source=C:\temp\NorthWind.vdb3;"/></connectionStrings>< lightSpeedContexts default="ourDufus">< add name="ourDufus" connectionStringName="nwVdb" dataProvider="VistaDB3" identityMethod="KeyTable" pluralizeTableNames="true"/> <add name="dufus" connectionStringName="NwSql" dataProvider="SqlServer2005" identityMethod="KeyTable" pluralizeTableNames="true"/></ lightSpeedContexts>when I do the vistadb stuff I get Unhandled Exception: System.Data.SqlClient.SqlException: A network-related or in |
|
|
It looks like this is loading the SQL Server configuration ("dufus") rather than the VistaDB configuration ("ourDufus"). Could you post the code that creates the LightSpeedContext and the unit of work? Thanks! |
|
|
I am evaluating your product and as usual you find things that do not work I set the provider in the app.configdataProvider ="VistaDB3"when I changed to _context.DataProvider = DataProvider.VistaDB3I use EntitySpaces and their VistaDb provider is a MEMORY HOG and its performance is crappy to be kind We will be purchasing in the next day if the rest of my test work as well as these Cheers, |
|
|
In my attempt to learn LightSpeed with my VistaDB databases, I am trying to replicate the Video Demo CRUD example but using VistaDB as the data store.
There seems to be a syntax problem with the "Get Started" app.config items that are automatically suggested when right-clicking the lsmodel designer canvass.
The configuration string comes across as:
<connectionStrings> <add name="Development" connectionString="Data" Source="C:\Users\KDJ\Documents\My Databases\LS_StorageBoxes_VistaDB.vdb4""/> </connectionStrings>
which inflicts the following grumblings: Error 1 Missing required whitespace. C:\Users\KDJ\Documents\Visual Studio 2008\Projects\StorageBoxes_Console_VistaDB\StorageBoxes_Console_VistaDB\App.config 19 107 StorageBoxes_Console_VistaDB- Missing attribute name
Error 2 Missing attribute name. C:\Users\KDJ\Documents\Visual Studio 2008\Projects\StorageBoxes_Console_VistaDB\StorageBoxes_Console_VistaDB\App.config 19 107 StorageBoxes_Console_VistaDB
Error 3 Character '<', hexadecimal value 0x3c is illegal in XML attribute values. C:\Users\KDJ\Documents\Visual Studio 2008\Projects\StorageBoxes_Console_VistaDB\StorageBoxes_Console_VistaDB\App.config 20 3 StorageBoxes_Console_VistaDB
Error 4 Expecting '>'. C:\Users\KDJ\Documents\Visual Studio 2008\Projects\StorageBoxes_Console_VistaDB\StorageBoxes_Console_VistaDB\App.config 20 3 StorageBoxes_Console_VistaDB
Error 5 Tag was not closed. C:\Users\KDJ\Documents\Visual Studio 2008\Projects\StorageBoxes_Console_VistaDB\StorageBoxes_Console_VistaDB\App.config 18 6 StorageBoxes_Console_VistaDB
When I copy and paste a connection string generated by VistaDB when added as a .Net Data Source, the syntax errors are eliminated.
<connectionStrings> <add name="Development" connectionString="Data Source="C:\Users\KDJ\Documents\My Databases\LS_StorageBoxes_VistaDB.vdb4"" providerName="System.Data.VistaDB" /> </connectionStrings>
The Repository.cs file was made exactly as the screencast video portrays.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mindscape.LightSpeed;
namespace StorageBoxes_Console_VistaDB { public static class Repository { private static LightSpeedContext<ModelUnitOfWork> _context;
public static LightSpeedContext<ModelUnitOfWork> Context { get { if (_context == null) { _context = new LightSpeedContext<ModelUnitOfWork>(); _context.ConnectionString = LightSpeedContext.Default.ConnectionString; _context.PluralizeTableNames = LightSpeedContext.Default.PluralizeTableNames; _context.IdentityMethod = IdentityMethod.KeyTable;
} return _context; } } } }
The main program code is as follows:
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace StorageBoxes_Console_VistaDB { class Program { static void Main(string[] args) { using (ModelUnitOfWork uow = Repository.Context.CreateUnitOfWork()) { Console.WriteLine("Boxes: " + uow.Boxes.Count()); Box box = new Box(); box.BoxNumber = "1029"; box.BoxDescription = "Religious books";
uow.Add(box); uow.SaveChanges();
Console.WriteLine("Boxes: " + uow.Boxes.Count());
} Console.ReadLine(); } } }
The program fails at the first Console.WriteLine("Boxes: " + uow.Boxes.Count());
SqlException was unhandled A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
This is the contents of the app.config file.
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="lightSpeedContexts" type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" /> </configSections>
<lightSpeedContexts> <!-- TODO: Check pluralizeTableNames setting --> <!-- TODO: Add identityMethod="..." if not using KeyTable --> <add name="Development" connectionStringName="Development" dataProvider="VistaDB4" identityMethod="KeyTable" pluralizeTableNames="true" /> </lightSpeedContexts>
<connectionStrings> <add name="Development" connectionString="Data Source="C:\Users\KDJ\Documents\My Databases\LS_StorageBoxes_VistaDB.vdb4"" providerName="System.Data.VistaDB" /> </connectionStrings>
</configuration>
Questions:
1. Why/where/how is LightSpeed getting an error message from the SQL server. As far as I can tell there is nothing in this little project that has anything to do with SQL Server 2005/sqlexpress.
2. What more do I need to do to get the LightSpeed model to actually point to the VistaDB database?
3. What are the connection settings that you use in your testing projects with VistaDB?
I am using MS Studio 2008 Professional Version 9.0.30729.1 SP and Microsoft .Net Framework Version 3.5 SP1
Thanks for your advice.
Kenneth James
|
|
|
With a lot more trial-in-error exploration . . .
1. I was able to add tables from the lsmodel canvass to an empty VistaDB database connected to the ServerExplorer. LS obviously can connect to the VistaDB provider or the lsmodel could not have been sent to the data store.
2. I removed the app.config file from the solution.
3. I changed the respository.cs to "hard wire" the connection string and data provider as follows:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mindscape.LightSpeed;
namespace LSVistaDB_01 { public static class Repository { private static LightSpeedContext<ModelUnitOfWork> _context;
public static LightSpeedContext<ModelUnitOfWork> Context { get { if (_context == null) { _context = new LightSpeedContext<ModelUnitOfWork>(); _context.ConnectionString = @"Data Source=C:\Users\KDJ\Documents\LS_VistaDB_Testing\LSVistaDB_01.vdb4;"; _context.DataProvider = DataProvider.VistaDB4; _context.IdentityMethod = IdentityMethod.KeyTable;
} return _context; } } } }
4. Now everything works as expected.
So my question still is, what is happening with those "default" statements that were in the repository.cs and why didn't they point to the VistaDB instead of some SQL instance?
LS is a great product. I keep having these "Aw so" moments when I get little Linq queries to do amazing things for me.
Kenneth James
|
|
|
Hello Kenneth, |
|