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
|
Hi all, first of all I'm still using LightSpeed version 2.0, because the company I work for is still using Visual Studio 2005. Then my problem: we have 3 tables for grouping accounts:
The linkage is: Schemas could have 1 to many Groups; Groups could have 0 to many Accounts linked, but the same Account could appear in more than 1 Group (many to many); more, for the Schemas, a schema could hold 0 to n sub-schemas, a sub-schema could hold 0 to many sub-sub-schemas, and so on. The internal relationship between parent and child schemas is performed using a parentID that must corresponds to a schemaID. My problem is: when I load the entire tree, the majior class (Schemas) returns all the related groups, but doesn't return the related sub_schemas (child schemas)... Everithing in the Schema class for LightSpeed seems to be properly defined, but, at the end of loading, it returns the related Groups, but the Schema children are empty; therefore, the sub-schema returns perfectly who is the ancestor. Could you, please, help me in understanding where I did something wrong? And which is the best solution? Please consider that I should need to expose in the UI all the information in a treeview. Thanks in advance for your help, Francesco |
|
|
It sounds like the Schema.SubSchemas collection isn't getting populated. Since you're on VS2005, you're hand-coding the entities rather than using the designer, so it's possible you've overlooked calling the Get method in the SubSchemas property. That is, you might have written:
whereas what you need to write is:
Could that be the problem? If not could you post the Schema entity class? By the way, LightSpeed 4 does include a .NET 2.0-compatible version of the LightSpeed DLL which you should be able to use in VS2005. It's installed in the Bin\Compatibility subdirectory. We no longer support LightSpeed 2, so if any bug fixes or enhancements are needed to resolve your issue, you will have to upgrade. |
|
|
Hi Ivan, thanks for your quick reply and for the info... My class, at the moment, is build as you suggest. Please find here below the class code:
[Serializable]
[System.ComponentModel.DataObject]
[Table("SLF_KTOGSCHEMA", IdColumnName = "IDKGS", Schema = "MAN")]
[OrderBy("Szbez")]
public partial class SlfKtogschema : Entity
pragma warning disable 649 // "Field is never assigned to" - LightSpeed assigns these fields internally
pragma warning restore 649
} Please, find, also, below the Oracle script for the table itself: CREATE TABLE SLFKTOGSCHEMA ( IDKGS NUMBER NOT NULL, UDKGS VARCHAR2(30 BYTE) NOT NULL, IDPARKGS NUMBER, SZBEZ VARCHAR2(120 BYTE) NOT NULL, ISVALID CHAR(1 BYTE) DEFAULT 'Y' NOT NULL, ISRULEBASED CHAR(1 BYTE) DEFAULT 'N' CONSTRAINT NNSLFKTOGSCHEMAISRULEBASED NOT NULL, ISUNIQUE CHAR(1 BYTE) DEFAULT 'Y' CONSTRAINT NNSLFKTOGSCHEMAISUNIQUE NOT NULL, ISBYMASTERONLY CHAR(1 BYTE) DEFAULT 'Y' CONSTRAINT NNSLFKGSISBYMASTERONLY NOT NULL, CREATEDON DATE DEFAULT SYSdate NOT NULL, CREATEDBY VARCHAR2(20 BYTE) DEFAULT 'MAN' NOT NULL, UPDATEDON DATE DEFAULT sysdate NOT NULL, UPDATEDBY VARCHAR2(20 BYTE) DEFAULT 'MAN' NOT NULL, DELETEDON DATE, ISMASTER CHAR(1 BYTE) NOT NULL ) TABLESPACE ASMDATA PCTUSED 40 PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFERPOOL DEFAULT ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING; COMMENT ON TABLE SLF_KTOGSCHEMA IS 'Account group schemas. The ISVALID Field sets if the group is still valid. This table represents a tree structure (Parent - Child) relationship to organize the schemas.'; COMMENT ON COLUMN SLF_KTOGSCHEMA.ISMASTER IS 'FLag for master schema (Y/N)'; COMMENT ON COLUMN SLF_KTOGSCHEMA.IDKGS IS 'ID (internal MAN) of the account group schema'; COMMENT ON COLUMN SLF_KTOGSCHEMA.UDKGS IS 'Code for the account group schema'; COMMENT ON COLUMN SLF_KTOGSCHEMA.IDPARKGS IS 'ID (internal MAN) of the parent account group schema. IDPARKGS=IDKGS for master schemas'; COMMENT ON COLUMN SLF_KTOGSCHEMA.SZBEZ IS 'Designation of the account group schema'; COMMENT ON COLUMN SLF_KTOGSCHEMA.ISVALID IS 'Flag for validity of the data record (Y/N)'; COMMENT ON COLUMN SLF_KTOGSCHEMA.ISRULEBASED IS 'Flag indicating whether accounts are assigned according to self-defined rules (Y) or manually (N)'; COMMENT ON COLUMN SLF_KTOGSCHEMA.ISUNIQUE IS 'Flag indicating whether an account can only be assigned to one group (Y) or not (N)'; COMMENT ON COLUMN SLF_KTOGSCHEMA.ISBYMASTERONLY IS 'Flags indicating whether allocations are only possible via master groups'; COMMENT ON COLUMN SLF_KTOGSCHEMA.CREATEDON IS 'DateTime of creation'; COMMENT ON COLUMN SLF_KTOGSCHEMA.CREATEDBY IS 'User created the record'; COMMENT ON COLUMN SLF_KTOGSCHEMA.UPDATEDON IS 'DateTime of Update'; COMMENT ON COLUMN SLF_KTOGSCHEMA.UPDATEDBY IS 'User updated the record'; COMMENT ON COLUMN SLF_KTOGSCHEMA.DELETEDON IS 'Soft Delete of the Record. Managed by Mindscape LightSpeed entity.'; CREATE UNIQUE INDEX SLFKTOGSCHEMAPK ON SLFKTOGSCHEMA (IDKGS) LOGGING TABLESPACE ASMDATA PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NOPARALLEL; CREATE UNIQUE INDEX AKSLFKTOGSCHEMA ON SLFKTOGSCHEMA (IDKGS, IDPARKGS, ISVALID) LOGGING TABLESPACE ASMDATA PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NOPARALLEL; CREATE INDEX IDXUDKGS ON SLFKTOGSCHEMA (UDKGS) LOGGING TABLESPACE ASMDATA PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFERPOOL DEFAULT ) NOPARALLEL; ALTER TABLE SLFKTOGSCHEMA ADD ( CONSTRAINT CHKKTOGSCHEMA_ISVALID CHECK (ISVALID IN ('Y','N'))); ALTER TABLE SLFKTOGSCHEMA ADD ( CONSTRAINT SLFKTOGSCHEMAPK PRIMARY KEY (IDKGS) USING INDEX TABLESPACE ASMDATA PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 )); ALTER TABLE SLFKTOGSCHEMA ADD ( CONSTRAINT FKPARKGSKGS FOREIGN KEY (IDPARKGS) REFERENCES SLFKTOGSCHEMA (IDKGS)); I think everything is done as it should be, but... I'm not perfect (almost not always ;-D) Thanks in advance for your help, Francesco |
|
|
The problem is that you can't eager load an association to self, because we'd need to issue an indefinitely long set of queries for this (because when you load Schema A, we'd need to also select all of Schema A's schemas, and all of Schema A's schemas' schemas, and...). Associations to self must be lazy loaded. The current version of the designer emits a validation error for this. Set Eager Load to false on the SlfKtogschema.SlfKtogschemas association and you should be good to go. |
|