global bucket templates Question

Posts   
 
    
erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 01-Apr-2005 03:00:20   

I have been attempting to get global buckets managers to work. It looks as though the global bucket templates have no way of passing in a value for a predicate expression. For example, most of my tables have a companyId field associated with it. I was thinking I could create a generic predicate expression (using the global templates that would filter tables based on the companyId. However, I need to pass in the companyId to the predicate expression. So it doesn't seem as though this is what the global bucket templates were designed to do. Could anyone shed some light on the global templates purpose and use of the global buckets templates. thanks, much appreciated. Maybe there is a way to do this I just can't figure out how.

Eric

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 01-Apr-2005 22:03:50   

I've never used them, so I can't comment on them.

Frans Bouma | Lead developer LLBLGen Pro
erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 02-Apr-2005 06:45:07   

thanks, no problem, not really an issue, just wanted to understand when to use them.

cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 03-Apr-2005 04:04:55   

First you create a new EntityBucketType value.


public enum BlahBucketType
{
    None,
    SomethingMeaningfull,
}

Then you create a predicate and relationship property with the same name as your BucketType


public class BlahPredicate
{
    public IPredicateExpression SomethingMeaningfull
    {
        PredicateExpression toReturn = new PredicateExpression();
        toReturn.Add( PredicateFactory.CompareValue( BlahFieldIndex.CompanyId, ComparisonOperator.Equal, 25 ) );

        return toReturn;
    }
}


public class BlahRelation
{
    public IRelationCollection SomethingMeaningfull
    {
        get
        {
            return null;
        }
    }
}

Then use the BucketFactory class to get the bucket.


RelationPredicateBucket bucket = BucketFactory.Create( BlahBucketType.SomethingMeaningfull );

G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 21-Oct-2005 13:47:37   

So if I am correct and have an entity named Project, and I have 5 companies, I have to create an enum for all 5 companies and then I have create 5 Expressions and then I can use this as a filter?

Which means I have to change my code if I get another Company in my database?

Isn't it possible to create this using soemhow a parameter to pass the company ID to the filter?

Gr.,

G.I.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 21-Oct-2005 14:59:44   

What exactly are you trying to achieve?

Frans Bouma | Lead developer LLBLGen Pro
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 24-Oct-2005 08:35:07   

Well,

it seems nice those kind of global predicates, but they are used based on hard programmed data. So if you have 5 companies, you can create a filter for all 5 companies. But what if I add a sixth company, then I have to change the code to add another enum.

What seems nice to me is to have global predicates which provided with a parameter can be used. If you for example have the companyId as a parameter.

What is most used by me:

Filter by ID's, filter by Status, filter by dates and filter by string values.

I know I can program everything myself, but what if these predicates are automatically created like those global bucket predicates.

That's what I want.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 24-Oct-2005 10:45:08   

G.I. wrote:

Well,

it seems nice those kind of global predicates, but they are used based on hard programmed data. So if you have 5 companies, you can create a filter for all 5 companies. But what if I add a sixth company, then I have to change the code to add another enum.

What seems nice to me is to have global predicates which provided with a parameter can be used. If you for example have the companyId as a parameter.

What is most used by me:

Filter by ID's, filter by Status, filter by dates and filter by string values.

I know I can program everything myself, but what if these predicates are automatically created like those global bucket predicates.

That's what I want.

Ok, so in short you want to create templates which generate predicate/relationpredicatebucket objects with field filters for fields which are an ID, status, which have type date, string... ? (I didnt' write the manager templates so I don't exactly know how they work internally)

Frans Bouma | Lead developer LLBLGen Pro