Forward generating errors for IList and extra tables with troncated names

Thread is closed for posting
4 posts, 0 answers
  1. Pierre
    Pierre avatar
    138 posts
    Member since:
    Feb 2006

    Posted 13 Jan 2010 Link to this post

    Hi Ady,

    I can´t access to reply button in the ticketing support.
    You can found one sample in this Project. You must add OpenAccess reference in bin folder. I have used from schemas xsd to create custom classes and forward map from these classes. The Database generated is not very clear ( many tables?). It's seam that IList object aren't generated very well generating truncated names and multiplicating tables. I wound prefer that openAccess make one forward map from xsd schema files, but that's id for later.

    Regards

    Old Post

    Posted on on Jan 6

    Hi,

    I´m working in one complexe forwarding map to generating Database sqlserver  from existing schemas for one Edi system. I have created numerous classes for the schemas and triing one forwarding map testing openAccess. During wizard and after generating i have numerous tables that having sub tables generated with troncated names, troncated id's names and relations.It's not very clear. In my classes i have many custom types and IList<T>. When i see classes i can't see errors. Compiling is no errors but wizard is generating errors and need to push done button to go out. Q2.2009. Advice please.

    sample class
    [Telerik.OpenAccess.Persistent()]  
        public partial class DTEDefType {    
            private object itemField;  
            private SignatureType signatureField;   
            private decimal versionField;  
              
            public DTEDefType() {  
                this.signatureField = new SignatureType();  
                this.versionField = ((decimal)(1.0m));  
            }  
              
            public object Item {  
                get {  
                    return this.itemField;  
                }  
                set {  
                    this.itemField = value;  
                }  
            }  
              
            public SignatureType Signature {  
                get {  
                    return this.signatureField;  
                }  
                set {  
                    this.signatureField = value;  
                }  
            }  
              
            public decimal version {  
                get {  
                    return this.versionField;  
                }  
                set {  
                    this.versionField = value;  
                }  
            }  
        }  
     
        [Telerik.OpenAccess.Persistent()]  
        public partial class DTEDefTypeDocumento {   
            private DTEDefTypeDocumentoEncabezado encabezadoField;  
            private IList<DTEDefTypeDocumentoDetalle> detalleField;   
            private IList<DTEDefTypeDocumentoSubTotInfo> subTotInfoField;   
            private IList<DTEDefTypeDocumentoDscRcgGlobal> dscRcgGlobalField;  
            private IList<DTEDefTypeDocumentoReferencia> referenciaField;    
            private IList<DTEDefTypeDocumentoComisiones> comisionesField;      
            private DTEDefTypeDocumentoTED tEDField;      
            private System.DateTime tmstFirmaField;    
            private string idField;  
              
            public DTEDefTypeDocumento() {  
                this.tEDField = new DTEDefTypeDocumentoTED();  
                this.comisionesField = new List<DTEDefTypeDocumentoComisiones>();  
                this.referenciaField = new List<DTEDefTypeDocumentoReferencia>();  
                this.dscRcgGlobalField = new List<DTEDefTypeDocumentoDscRcgGlobal>();  
                this.subTotInfoField = new List<DTEDefTypeDocumentoSubTotInfo>();  
                this.detalleField = new List<DTEDefTypeDocumentoDetalle>();  
                this.encabezadoField = new DTEDefTypeDocumentoEncabezado();  
            }  
              
            public DTEDefTypeDocumentoEncabezado Encabezado {  
                get {  
                    return this.encabezadoField;  
                }  
                set {  
                    this.encabezadoField = value;  
                }  
            }  
              
            public IList<DTEDefTypeDocumentoDetalle> Detalle {  
                get {  
                    return this.detalleField;  
                }  
                set {  
                    this.detalleField = value;  
                }  
            }  
              
            public IList<DTEDefTypeDocumentoSubTotInfo> SubTotInfo {  
                get {  
                    return this.subTotInfoField;  
                }  
                set {  
                    this.subTotInfoField = value;  
                }  
            }  
              
            public IList<DTEDefTypeDocumentoDscRcgGlobal> DscRcgGlobal {  
                get {  
                    return this.dscRcgGlobalField;  
                }  
                set {  
                    this.dscRcgGlobalField = value;  
                }  
            }  
              
            public IList<DTEDefTypeDocumentoReferencia> Referencia {  
                get {  
                    return this.referenciaField;  
                }  
                set {  
                    this.referenciaField = value;  
                }  
            }  
              
            public IList<DTEDefTypeDocumentoComisiones> Comisiones {  
                get {  
                    return this.comisionesField;  
                }  
                set {  
                    this.comisionesField = value;  
                }  
            }  
              
            public DTEDefTypeDocumentoTED TED {  
                get {  
                    return this.tEDField;  
                }  
                set {  
                    this.tEDField = value;  
                }  
            }  
              
            public System.DateTime TmstFirma {  
                get {  
                    return this.tmstFirmaField;  
                }  
                set {  
                    this.tmstFirmaField = value;  
                }  
            }  
              
            public string ID {  
                get {  
                    return this.idField;  
                }  
                set {  
                    this.idField = value;  
                }  
            }  
        } 
  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 15 Jan 2010 Link to this post

    Hi Pierre,

     The default naming mechanism of OpenAccess insert underscores ( '_') between higher case letters to generate the table name from the class name. This is the reason why the table names for your model are a bit unclear. You can switch this off and use the model names (class and field names) instead to derive the table names.  This can be done by using the 'Backend Configuration' wizard and setting the 'Use model field names for column names' property under the 'Name Generation' category.
    Lists can be maintained using join tables or an inverse pointer. You can find more details on how to map a collection, here

    Hope this helps

    Sincerely yours,
    Ady
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Pierre
    Pierre avatar
    138 posts
    Member since:
    Feb 2006

    Posted 15 Jan 2010 Link to this post

    Hi Ady,

    I have tested switch off the table names, but similar result.
    This is not the big problem the table names, but the multigenerated tables from same content enumerating same variables. In some cases i have more than 5 to 15 tables generated. I have posted one link to load the full project HERE and this time is un public side to load. This project start from one schema to go to the database you have the steps, i found you full classes to perform the test.
    More, I have in forward mapping errors in persited classes like System.ArgumentOutOfRangeException occurred.Length cannot be less than zero. Contact telerik!

    Thanks, Romi


  4. Ady
    Admin
    Ady avatar
    589 posts

    Posted 15 Jan 2010 Link to this post

    Hi Pierre,

     To explain the table name generation let me consider the following classes from your model - BOLETADefTypeDocumentoTEDDDCAF and class BOLETADefTypeDocumentoTEDDD.
    Note that both the class names are same till the '...DDD' in the first class. OpenAccess creates the same name till then and then for the CAF it would have generated '_cf', but we would now cross the maximum identifier size if the table name is so big. Hence we detect duplicate column names for a size of 30 characters. To disambiguate this we append '2,3....' at the end. You can always manually change the table name using the wizard. Do you get an error from the server while attempting to creating a duplicate table? If yes, can you specify the name of this table.

    How can I reproduce the 'System.ArgumentOutOfRangeException'? I did build and run a sample application that connects to the database using your class model, successfully.

    Greetings,
    Ady
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top