Fetch Entity in __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode

Posts   
 
    
christof
User
Posts: 19
Joined: 08-Jun-2008
# Posted on: 03-Sep-2013 16:39:00   

Hello Support

my problem is that I do not hammer out data from a Entity to load, which is not performed as a relation

I have tried


#region Custom Entity code
// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
public string AusfuehrnderSs
        {
            get
            {
                try
                {
                     //I need this Entity to Fetch       the parameter  Ausfuehrender is the 
                                                                         Primary Key from MeldenummmerEntity        
                    var mm= new MeldenummmerEntity(Ausfuehrender);

                     //The Entity MeldenummmerEntity is always Empty (was not even fetched)
                     //How Can I Fetch this Entity
                    return mm.NameVorname;
                    
                }
                catch (Exception ex)
                {
                    return string.Empty;
                }
            }
        }

    // __LLBLGENPRO_USER_CODE_REGION_END
        #endregion

A Relation between AuftraginstandhaltungEntity and MeldenummmerEntity is not posible, because the fields have different Types Example (integer, bigint) I use Firebird as Database

I hope you can help me

Best Regards Christof

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Sep-2013 18:31:09   

I find it hard to understand your question.

Which version of LLBLGen pro are you using? Which template set?

In which Entity class is the above mentioned code? And when and where are you calling the property in that code_region?

christof
User
Posts: 19
Joined: 08-Jun-2008
# Posted on: 03-Sep-2013 18:52:50   

I find it hard to understand your question.

Sorry

Which version of LLBLGen pro are you using?

Version 4

Which template set?

I use LLBLGen Pro Runtime Framework as Adapter SD.Presets.Adapter.General

In which Entity class is the above mentioned code?

AuftraginstandhaltungEntity.cs

And when and where are you calling the property in that code_region?

I have Attacht the File AuftraginstandhaltungEntity.cs

Attachments
Filename File size Added on Approval
AuftraginstandhaltungEntity.zip 12,996 03-Sep-2013 20:46.12 Approved
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Sep-2013 18:54:40   

Nothing is attached. The code you have posted won't fetch the entity. See in Adapter you need to fetch the entity using a DataAccessAdapter object. This could have worked if you were using SelfServicing.

christof
User
Posts: 19
Joined: 08-Jun-2008
# Posted on: 03-Sep-2013 19:02:09   

Attachment is in Status Pending

https://www.dropbox.com/s/de1pdxsli5sfx89/AuftraginstandhaltungEntity.zip

I use Adapter

Yes I know tat this Code not fetch, but in this Class is the DataAccessAdapter not present

Attachments
Filename File size Added on Approval
AuftraginstandhaltungEntity.zip 12,996 03-Sep-2013 20:46.44 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Sep-2013 08:13:47   

You are using Adapter TemplateSet. In this scenario (Adapter) you have two generated projects: DatabaseGeneric and DatabaseSpecific.

DatabaseGeneric contains all the entity classes, collections, relations, etc., so it contains all you Model. DatabaseSpecific, on the other hand contains all the logic to fetch entities, that includes the DataAccessAdapter class. Both projects are independent of each other, so you don't have assemblie reference from DatabaseGeneric to DatabaseSpecific and viceversa.

That said, you can't fetch entities from inside other entity. You can do it outside, using the DataAccessAdapter class. If you would use SelfServicing, then you can, because on SelfServicing both the entities and the persistence logic is at the same project.

To understand this better, see Templates and Templates groups.

So, maybe what you need is to create a third project (Manager, GUI, etc.) where you use both your DBGeneric and DBSpecific project to fetch what you need.

David Elizondo | LLBLGen Support Team
christof
User
Posts: 19
Joined: 08-Jun-2008
# Posted on: 04-Sep-2013 09:38:03   

I've already thought that this scenario does not work I understand this now Thank you very much

Christof