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 evaluate Lightspeed 2.2 for LINQ to Oracle9 using C# in VS2008. I have been following the Getting Started Screencast, and have run into a wall, and haven't been able to find a solution. I have verified the Mindscape.LightSpeed and Mindscape.LightSpee.Linq references are being pulled in. Here's my App.config: <?xml version="1.0" encoding="utf-8" ?>
Message 1 Could not find schema information for the element 'lightSpeedContexts'. C:\Visual Studio 2008\Projects\LSTestApp2\LSTestApp2\App.config 14 4 LSTestApp2 I tried to resolve the references, but could not. So I went on to see if they would resolve by later code. I code the rest of the example without incident, with the exception that I needed to add the 2 Mindscape "using" statements (LightSpeed and LightSpeed.Linq) to pull in the class references. But when I try to run it, I get an error in the Repository.cs file. using System; When I run the app, it throws 2 errors: |
|
|
The "missing schema" informational message is benign. It just means Visual Studio is trying to show intellisense for the tags inside <lightSpeedContexts> but because there's no XSD file for this element it can't do so. So all it means is you won't get intellisense when typing that part of the .config file: there's no runtime impact. Regarding the runtime error, this looks like it is not finding the connection string for some reason. My guess is that there is a typo somewhere which is causing LightSpeed either not to find the connectionStringName declaration, or not to match it up with the entry in the <connectionStrings> section -- possibly a case difference or extraneous space? However it looks okay from what you've posted. Could you post your app.config as an attachment (you can do this via the Options tab) please and we will see if we can reproduce the problem -- thanks! Also, can you clarify whether you are seeing only first chance exceptions within LightSpeed, or actual unhandled exceptions being thrown from LightSpeed? (I'm assuming the latter.) |
|
|
Thanks. I went back in to verify the error and a totally different error is now appearing. I recreated the test from scratch to verify, and the error is consistent. I put the App.config, Repository.cs and Program.cs in attachment (LSTest3.txt). I have the following references set: Mindscape.LightSpeed, Mindscape.LightSpeed.Linq, PRIMARYLib, System, System.Core, System.Data, System.Data.DataSetExtensions, System.Data.OracleClient, System.Xml and System.XML.Linq. I also verified the file is accessable within Visual Studio by showing the table data from the Server Explorer. The config setup is copied from "Get Started" from the lsmodel. Now when I run the test, I get the error: A first chance exception of type 'System.ArgumentException' occurred in System.Data.dll Here is the Detail: System.Data.SqlClient.SqlException was unhandled |
|
|
I got an error posting the message. Please let me know if the attachments didn't upload. |
|
|
The attachment didn't upload, but the error you posted suggests that LightSpeed is now receiving the connection string correctly, but that the SQL Server name may not be correct, or that the SQL Server instance can't be reached (for example because the appropriate protocol is not enabled). Since you can see the database in Server Explorer, the former is more likely: check the Data Source in the connection string. That said, in your original post, you showed Oracle9 as the data provider, not SQL Server. Is that still the case? If so, it means LightSpeed is for some reason not getting the configuration settings at all (SQL Server is what it defaults to if you don't specify a DataProvider). If this is the case, could you zip up your app.config, Repository.cs and Program.cs and mail them to me on ivan @ the obvious domain name and I will take a look. Thanks! |
|
|
That is correct. It should be a connection to an Oracle 9 database. I have emailed you the requested files.
Thanks! |
|
|
Hello Richard, I can't reproduce your first exception: when I run your code, I get the correct connection string. However, as you have found, it does now try to use SQL Server rather than Oracle. The reason for this is that you are creating a blank LightSpeedContext, then copying properties from LightSpeedContext.Default. You copy the connection string, but you don't copy the DataProvider, so your context retains the "blank context" SqlServer2005 provider. There are two ways around this, a good way and a bad way. The bad way is to add a line to your copy code to copy the DataProvider: _context.DataProvider = LightSpeedContext.Default.DataProvider; The reason this is bad is because you have to remember to do this for every setting. For example if you later added a quoteIdentifiers option to your app.config you would need to add code to copy the QuoteIdentifiers property. The good way is to throw out the copy code, forget about LightSpeedContext.Default, and initialise your LightSpeedContext directly from the configuration entry: _context = new LightSpeedContext<ModelUnitOfWork>("Development"); This creates a context based on the Development entry in the lightSpeedContexts section, rather than a blank context. So you don't need to do any copying at all: the context will already be initialised with the settings from the configuration file. If you scroll down in the Getting Started window to the code sample then you'll see sample code for this pattern. In general I'd strongly advise passing the configuration section name. Stay away from LightSpeedContext.Default: it only ever really existed to help users who were migrating from LightSpeed 1.x. Unfortunately, early in the 2.x cycle we did release a couple of blog posts and screencasts that described the "copy from LightSpeedContext.Default" method. These were wrong and I've asked for them to be removed or corrected. We apologise for the confusion. Please let us know if you still see problems after adding the section name to the "new" call and removing the copy code. |
|
|
That did the trick! Thank you! |
|
|
Hello, i've got a similar problem. To leran something about lightwave i tried to create a new database as in the "Getting Started Screencast" is shown. I do everything step by step, but it dosn't work as in the example. I use the german version of Visual Studio 2009. I created a small test database with some entities and properties to test purposes. But if i try to create my application, first there are the same messages as Richard had got: "Could not find schema information for the element 'lightSpeedContexts' at ...App.config" etc. And if i run my testfile, i get the following error-message: "Beim Erstellen des Konfigurationsabschnittshandlers für "lightSpeedContexts" ist ein Fehler aufgetreten.: Der Typ "Mindscape.LightSpeed.ConfigurationSection" in der Assembly "Mindscape.LightSpeed" konnte nicht geladen werden. (C:\Dokumente und Einstellungen\jingwersen\Eigene Dateien\Visual Studio 2008\Projects\testtest\Demo\bin\Debug\Demo.vshost.exe.Config line 5)" You see, it is the german version,...in english it means something like "Error at Configuration section handler for "lightSpeedContexts". The type "Mindscape.LightSpeed.ConfigurationSection" could not be loaded by the Assembly "Mindscape.LightSpeed". (C:\...\bin\Debug\Demo.vshost.exe.Config line 5)". So it looks like he has some problems with the part "<lightSpeedContexts>...</lightSpeedContexts> in my App.config. My code is the same one as in the tutorial. The only difference is the Database i created. I also try it with the english Version of vs2009 - here the "lightSpeedContexts errors" not occur, but the debug-error ("Mindscape.LightSpeed.ConfigurationSection could not be loaded by the Assembly") appears here too. Have somebody an idea why i can't start my application?
Thanks! Jörn |
|
|
Hi again, a little update: It was a mistaky by my self! A little misspelling in my App.config. Now the application starts, but the screen stays black. In the Screencast the numbers of products apperas in the dos-box, not so in my example. In the Screencast the code apperars by copy and paste. Is there a reference or somesthing else where i can get some existed code for test purposes?
Thank you!
|
|
|
Hi Jörn, Sorry to hear you're having some troubles. Mind posting the code to your main program file? Or email it to me at jd@mindscape.co.nz and I'll be happy to take a look (remove the dll files if you zip it up, Google for domains doesn't like executable files in zip files). Alternatively, you could post the snippets on pastie.org and send me the links :-) Thanks! John-Daniel |
|
|
Hi, and thaks for the fast reply! Now it works! I tried around some opportunities and now i can create database entries, show or remove them (like in the screencast) :)
I've got a file on my local pc (C:\...\...\testDB.db) and i want to display some entries of this SqLite database. I tried to change the "connectionString" in my App.config: <connectionStrings>
<lightSpeedContexts> Is this an right approach? How can i address the entries of the database? Is there a way to drag an drop the items in the store model like in the screencast? Or do i have to adapt everything manually in my "StoreModel.cs"? I would be grateful for some instructions or some examples where i can derive a solution.
Thanks a lot and a nice day Jörn
|
|
|
Yes, you can drag tables on from Server Explorer provided you have SQLite Visual Studio integration installed. Go into Start > SQLite.NET > Design Time Configuration and make sure that the option for your version of Visual Studio (VS2008 and/or VS2010) is checked. Now in Visual Studio you can use Server Explorer > Data Connections > Add Connection to add a connection to your SQLite database. You can then expand the connection to show the tables in the database, and drag the desired tables onto a LightSpeed model as shown in the screencast. |
|
|
Hey, thak you very much! That was very helpful! |
|