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 set out to test lightspeed, and for me, the important thing is beeing able to generate a layer for a legacy db application in oracle. So I start with lsgen, which does this almost perfectly. There is one showstopper, and a couple of requests. Showstopper The code does not compile. The reason is at that a couple of places in the database there are two relations from table a, to table b, ie two foreign keys. This results in two internal EntityCollection with the same name, and two public getters of the same name. Which of course, does not compile. Request: We have a stored proc layer generator which we use for all stored procedures in oracle, which I have written myself. One feature I like about the tool I use, is that it compiles everything in memory, and outputs just a DLL. Is it possible to add code to compile instead of outputting sourcecode? Prefeably I would not every need to see sourcecode hit the disk.
Here is the source code we use for compiling a string to a dll: CSharpCodeProvider codeProvider = new CSharpCodeProvider(); CompilerParameters parameters = new CompilerParameters();parameters.GenerateExecutable = false;parameters.OutputAssembly = outputAssemblypath; parameters.GenerateInMemory = false;parameters.IncludeDebugInformation = false;parameters.ReferencedAssemblies.Add("System.dll");parameters.ReferencedAssemblies.Add( "System.Data.dll");parameters.ReferencedAssemblies.Add("System.Data.OracleClient.dll");parameters.ReferencedAssemblies.Add( "System.Xml.dll");parameters.ReferencedAssemblies.Add("System.Configuration.dll");parameters.ReferencedAssemblies.Add( "System.Web.Services.dll");parameters.ReferencedAssemblies.Add("System.Web.dll");parameters.ReferencedAssemblies.Add("System.Transactions.dll");parameters.ReferencedAssemblies.Add(OracleDataAccessPath()); if(requireOracleUDT)parameters.ReferencedAssemblies.Add(UDTPath()); return codeProvider.CompileAssemblyFromSource(parameters, source);
|
|
|
Regarding the naming of duplicate associations, this is addressed in the current nightly build, which you can get from http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx (please note that you *MUST* manually uninstall the RTM version before installing a nightly -- and the nightly build installer will not warn about this -- this is *not* necessary if in future you upgrade from a nightly to another nightly). This will suffix duplicate associations with the name of the reverse association. You can also use the visual designer to manually import the tables from Oracle; this allows you to customise the names of the associations as required, which may give you something more meaningful! We will look at adding an auto-compile option but many domain models use partial classes to add domain logic to the model, and many developers will want to reference the LightSpeed DLLs at a custom project location (e.g. a project /Lib folder), so we are not sure how useful this will be -- plus there are considerations about whether to generate a debug or release build -- we don't want to bog lsgen down with lots of compilation options! Our recommendation would be to create a batch or script file that calls lsgen followed by csc.exe; this is of course slightly less performant than compiling in memory but I wouldn't have thought this would be a major issue, and it also means you don't need to re-enter the connection string, data provider etc. every time you run lsgen. However we are open to feedback if you think this approach is undesirable. |
|
|
Thank you very much for a prompt response. The designer is out of the question (It's a long story). Regarding compilation, I can live with it, no problem. But is it possible/legal to reference lsgen.exe myself and add compiling to it? The second showstopper for us is: http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=1988, my post is the last comment. |
|
|
lsgen.exe and the APIs that it builds on should be considered undocumented. In their current state, you may find them unfriendly and incomplete, and we may make breaking changes within a minor version. That said, a lot of the methods are public, and it shouldn't be too hard to build your own "lsgen with compilation" provided you're willing to do a bit of spelunking and to accept the occasional breaking change with equanimity! We won't stop you, and would be happy to answer questions and provide info about the code such as it is. We will be looking at providing a stable, documented API for the metamodel in a future release. We are looking at the multiple sequence issue and will post in that thread when we have an answer -- as you know you are not the first person to ask for it so we will see what we can do! |
|