|
|
Rank: Newbie Groups: Member
Joined: 10/5/2009 Posts: 7 Points: 21 Location: Derio
|
hello all
I have just generated classes and hbm files using nconstruct lite from my sql server database.
Nconstruct did a good work for me, but i have found two issues
1. Seems nconstruct ignores the default values declared in database columns. 2. nconstruct generates fields in alphabetical order, not in the order they have been created in the database.
of course, you can make these changes manually, but this is not a good solution for me. my database model has about 1200 fields distributed in 60 tables and views.
May be it should be easy to implement these two improvements for the next version !
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/29/2007 Posts: 67 Points: 201 Location: NConstruct Support Team
|
Hi, 1. We are using the OleDbConnection provider object and the following meta-data can be read from it: {ColumnName} {ColumnOrdinal} {ColumnSize} {NumericPrecision} {NumericScale} {DataType} {ProviderType} {IsLong} {AllowDBNull} {IsReadOnly} {IsRowVersion} {IsUnique} {IsKey} {IsAutoIncrement} {BaseSchemaName} {BaseCatalogName} {BaseTableName} {BaseColumnName} There is no default value that can be retrieved. If you are aware of any libray that gets the default values we can evaluate it and try to use it. 2. Regarding the properties sort order: We created the options dialog that you can use to apply the sort you want. It is also possible to set the logging for the NConstruct Builder application if needed. See figures below.    The new NConstruct version 2.5.1 will be available tomorrow. Regards, Pistotnik S. _______________________ NConstruct Support Team support@nconstruct.comhttp://www.nconstruct.com_______________________
|
|
Rank: Advanced Member Groups: Member
Joined: 8/29/2007 Posts: 67 Points: 201 Location: NConstruct Support Team
|
Hi Edu, The new NConstruct Lite version 2.5.1 is already available for download and you can get it from the following URL: http://www.nconstruct.com/Productfiles/NcbSetupLite.msiRegards, Pistotnik Sebastijan _______________________ NConstruct Support Team support@nconstruct.comhttp://www.nconstruct.com_______________________
|
|
Rank: Newbie Groups: Member
Joined: 10/5/2009 Posts: 7 Points: 21 Location: Derio
|
Thanks a lot for your improvement !
it will be very usefull to me.
...
For getting default values, maybe this code helps you (sorry it's vb.net) :
Imports System.Data.OleDb
Namespace utils Public Module Module1
Function get_defaults_for_table(ByVal connection_string As String, ByVal table_name As String) As String
Dim mySqlConnection As OleDbConnection Dim s As String = ""
Dim restrictions As String() = New String(3) {Nothing, Nothing, table_name, Nothing} mySqlConnection = New OleDbConnection(connection_string) mySqlConnection.Open()
'Dim o As System.Data.DataTable = mySqlConnection.GetSchema("Columns", restrictions) 'also works Dim o As System.Data.DataTable = mySqlConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, restrictions) Dim c As System.Data.DataRow
For Each c In o.Rows If c.Item("COLUMN_HASDEFAULT") = True Then s = s & (c.Item("COLUMN_NAME") + " default value is " + c.Item("COLUMN_DEFAULT").ToString) + "/" End If Next
mySqlConnection.Close()
Return s End Function
End Module End Namespace
Making this call
Console.WriteLine(Module1.get_defaults_for_table("Provider=sqloledb;Data Source=SD200001;Initial Catalog=Northwind;Integrated Security=SSPI;", "Products"))
i got this
UnitPrice default value is ((0))/UnitsInStock default value is ((0))/UnitsOnOrder default value is ((0))/ReorderLevel default value is ((0))/Discontinued default value is ((0))/
I have tested it in sql server, maybe it works in oracle too.
|
|
Rank: Advanced Member Groups: Member
Joined: 7/30/2007 Posts: 59 Points: 177
|
Hi edu, Great, thank you for your code snippet. We'll check if we can integrate it in the database schema examination and will let you know if or when it will be available in NConstruct software.
Regards Thomas
NConstruct Support Team support@nconstruct.comhttp://www.nconstruct.com
|
|
|
Guest |