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 get a dataset with associated records based on an aggregate (+/- 15 tables), then create the tables in a new mysql database (this part works) I am not creating all the tables Then write the data to the new database using attach() and import() This is where things are going wrong (i have been using lightspeed for only a few weeks) any assistance/pointers would be greatly appreciated i have pasted the relevant vb.net code below Private Function GetTablename(cName As String) As String Dim retval As String If cName.StartsWith("_") Then retval = cName.Substring(1) Else retval = cName End If If retval.EndsWith("s") Then Return retval.Substring(0, retval.Length - 1) End If Return retval End Function Private Function AddTable(cName As String) As Boolean If Not (cName.ToUpper.Contains("PORTFOLIO") Or cName.ToUpper.StartsWith("LK")) Then cName = GetTablename(cName) If mExpTables.IndexOf(cName) = -1 Then m_ExpTables.Add(cName) Return True End If End If Return False End Function Function LookForEntities(passoc As AssociationInfo) As Boolean For Each Ass1 As AssociationInfo In passoc.ChildType.Associations If AddTable(Ass1.FieldName) Then LookForEntities(Ass1) End If Next End Function 'NOTE: ' entityinfo() and assocaitioninfo() are based on the class info (compile time) not the returned entity info (runtime) ' associations sometimes pluralise tablenames ,sometimes not,not predictable , sometimes both occur with and without "s" ' associations.childtype.associations appears to be not recursive structure , so need to maintain list of tables found m_exptables and stop hunting downwards if table already on list ' cannot get tablename from associations metadata so guess singular then plural for table create ' cannot get aggregates info either hence check in addtable() routine based on tablename to exclude Private Sub tsExportClick(sender As Object, e As EventArgs) Handles tsExport.Click Using dbNet As IntDataUnitOfWork = Context() Dim pRet As Integer = 0 Dim cDb As String Dim Buff As New StringBuilder(dbNet.Context.ConnectionString) Dim ExpTemplate As List(Of ProductTemplate) = (From a In dbNet.ProductTemplates Where a.Id = mProductTemplateId).WithAggregate("ExpTemplate").ToList
|
|
|
What is the error you are encountering when importing the entities? I presume you are seeing an exception?
|
|