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
|
Hello. I am converting the MVC application Nerddinner to Linux/Apache/Mono/MySQL/Lightspeed. Its almost done. I plan on sharing it when its completed and perhaps with a tutorial if i find the time. When saving a new dinner, longitude and latitude are recieved from a map with dots instead of commas in the coordinates. For example: 74.123456 instead of 74,123456. Lightspeed can only convert the second value. Microsoft LINQ can convert both. I dont know if this is intentional or not, but maybe it would be nice if Lightspeed can replace dots with commas when converting from System.String to data types with decimals? Just an idea. Best regards, Andreas |
|
|
The parameter conversion from type 'System.String' to type 'System.Single' failed. left out the "failed" part in the subject ;) /Andreas |
|
|
Correction: The parameter conversion from type 'System.String' to type 'System.Double' failed. Not System.Single. More coffee............. zzz |
|
|
Hello, It looks like you are attempting to convert a Decimal string into a Double which will fail due to the loss of precission. If LightSpeed is wanting to convert to Double, then haven't you set the type wrong on the entity, should it not be Decimal. Good luck Scott |
|
|
Actually sorry ... I re-read the post and I was just being stupid - I see now what you were intending to do. [Would be nice if we could edit/delete posts] Scott |
|
|
Hello Andreas, I'm a little bit unsure about how this fits together. Where's the conversion happening? If your database and your model use matching types (e.g. MySQL double and C# double) then there shouldn't be any string conversion issues anywhere (or, at least, they should be handled externally to the LightSpeed layer). Is it that you are using a VARCHAR in the database but a double in the LightSpeed model, or a double in the database but a string in the LightSpeed model? Or is there some external source (the maps API?) that requires/dispenses strings -- if so, where are these being converted to the numeric value? The conversion project sounds interesting -- we'd love to hear about it when it's all working! |
|
|
Hi Ivan. Sorry for the vague explanation. English isnt my first language. I'll give it another try :D Nerddinner is a MVC application used in the book Professional ASP.NET MVC 1.0. It basically lets you register a user, search and find dinners hosted by other users, or create and host your own dinners, etc. Its a very popular starting point for learning ASP.NET MVC (like Northwind for SQL). You can find more information here: I've been looking for a way to develop ASP.NET MVC applications without having to cash out for Microsoft Server, MS SQL., and other expensive licenses. The most low cost solution (that i've found) is using Lightspeed on a linux machine running Apache, mod_mono, and a MySQL database (with the MySqlMemberShipProvider that comes with the latest MySQL Connector). To the problem: I am not sure if this is a Lightspeed problem anymore... it might very well be a mono mvc problem... I dont know the internal workings of MVC or Lightspeed that well (yet) :D Anyhow. I am going to finnish the application so that it matches the one in the book - http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf - and then share it with everyone of course. Sorry if i wasted your time... Best regards, Andreas |
|
|
Hmm, I *think* this may be something to do with the way MVC does binding -- presumably the map coordinates are doubles in your LightSpeed model and in your database, which would mean that the conversion error would be happening when MVC tried to convert your form fields to doubles. If you can get a stack trace for the exception that should help you determine whether it's in LightSpeed or the binder or somewhere else. I'll also pass this on to our local ASP.NET MVC guru to see if he can shed any light or give you any more specific pointers (though I don't think he knows the Mono port). |
|
|
Hi Andreas, As Ivan concluded, it sounds like a binding problem when the data is being processed by MVC. Couple of questions on this:
Also, did you have some more details about where the error is being fired from (a stack trace of the like would be useful)
Jeremy |
|
|
Hello. The error appears to be in Mono MVC. But I solved that by replacing the dots with commas. I have another error now. I cant drag MySQL stored procedures from the Server Explorer into the LightSpeed model. They're just not draggable... Again, i dont know if this is a LightSpeed problem or a MySQL Connector problem. I have the latest stable MySQL Connector and the latest stable LightSpeed Express. Visual Studio 2008... Have you ever experienced this problem? Best regards, |
|
|
I can reproduce the problem, but it appears to be a MySQL problem. It looks like drag-drop support (technically, DSRefBuilder support) has been turned off in the MySQL Connector for stored procedures. The stored procedure nodes simply do not seem to support dragging. And looking at the MySQL Connector source code confirms this. We definitely still have all the plumbing in place to receive dropped MySQL procedures -- just MySQL doesn't allow you to drag them. This is odd because I am pretty sure this used to work, though I can't find any change logs one way or the other. You'll probably need to raise this with the MySQL Connector guys. Sorry. |
|
|
I created a bug report and copied some of your text. I hope you dont mind. You can find it here if you want to subscribe to it: Thanks for all the help so far. |
|
|
Oh, another thing. Have you ever considered a second way to add entities to a model that doesnt require drag dropping? |
|
|
We've always had a way to add entities to a model without dragging and dropping from a database -- if fact many people use the LightSpeed designer to create their models from scratch and then build the database from the model! Just open the Visual Studio Toolbox tab, drag on an Entity or StoredProcedure, and add properties and parameters as required. |
|
|
Ah, nice! Though, i am not exactly sure how to configure an Entity from scratch... The stored procedure in question takes two REAL arguments and returns a resultset of id's (INTEGER). I've tried different Access Method's but cant find where i enter the name of my procedure, etc. Here's what the MySQL procedure looks like: Got any hints to get me started? /Andreas |
|
|
We have two idioms for using stored procedures: CRUD procedures and Select procedures. CRUD procedures are for when you are using Select, Insert, Update and Delete procedures for all entity access, typically because you're in a very locked-down enterprise where there's a policy that applications can't access tables directly. I don't think that's the case for you, so I won't cover the designer support for that any further. Select procedures are where you an additional way of querying for entities or performing projections, rather than issuing a SELECT call against the table directly. Now that we have support for projections, joins, SQL functions, etc., these are less relevant than they used to be, but they can still be handy. Here's how to model a Select procedure in the designer without dragging from a database. * From the Toolbox, drag on an Entity type to represent the result type. In your case, the only thing you're returning is an ID, so an empty entity will do fine. (You'll need to map the Identity Column Name to DinnerID though.) You can optionally set the Access Method to SelectProcedure -- this has no impact on the code but will stop the designer looking for a corresponding table if you use database sync. * From the Toolbox, drag on a SelectProcedure to represent the procedure itself. Set the Name to whatever you'd like to call it in the code (typically the same as the name in the database, but this isn't mandatory). Set the Procedure Name to the procedure name in the database (NearestDinners). Set the Entity Type to your entity type. Then add parameters by right-clicking the procedure shape. You should now be good to go! |
|
|
Hey Jeremy. I just realized that I was debugging the conversion problem in Visual Studio and had not published it to my Apache/Mono server for testing. That means i was using Microsoft MVC and not Mono MVC, and the problem might still be a Lightspeed one since it works with Microsoft LINQ. I am unbinding to a LightSpeed Entity and using a custom model binder. Sorry for raving around... i've been a little sleep deprived the last week :P I looked into the problem some more.... 1. With Microsoft MVC and Visual Studio's built in web server: 2. With Mono MVC on my Apache/mod_mono server: I'll get you all the details about the exception i get in in case 1 ASAP. /Andreas
|
|