Using EntityField2 with NonGenerics

Posts   
 
    
dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 25-May-2007 09:59:36   

I would like to get set a predicate on a nongenericentity without importing the generated llblgenclasses (just using ormsupportclasses)

like


       DataAccessAdapter da = new DataAccessAdapter();
        IRelationPredicateBucket bucket = new RelationPredicateBucket();
        IEntityField2 profileFilter = new EntityField2("profileid", null);
        bucket.PredicateExpression.Add(profileFilter != "");
        da.FetchEntityCollection(e.ContainedCollection, bucket, e.MaxNumberOfItemsToReturn, e.Sorter, e.PrefetchPath, e.PageNumber, e.PageSize);
    

is there a way to do this?

the code above doesn't work!

cheers andrew

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-May-2007 10:17:20   

Since you are passing all other variables as parameters(eg. e.prefetchPath & e.ContainedCollection), why don't you pass the entityField as well?

dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 25-May-2007 14:41:54   

I'm using PerformSelect of LLBLGenProDataSource2

so this is not really an option i think

cheers a

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-May-2007 16:01:34   

So I guess you define the PrefetchPath, programatically, aren't you? If so, you can also define a class scope/memnber variable that should hold the corresponding EntityField.

dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 25-May-2007 20:24:20   

Could you show us an example?

cheers a

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39914
Joined: 17-Aug-2003
# Posted on: 26-May-2007 15:38:26   

Why don't you want to use the entityfields ? (e.g. CustomerFields.CompanyName) ? that's what they're for: creating filters.

If you dont want to reference the generated code in the asp.net application, pass the other objects to a lower tier which does reference the generated code. BUt as you're using a dataaccessadapter anyway, why not use the fields as well?

Frans Bouma | Lead developer LLBLGen Pro
dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 27-May-2007 15:54:34   

I want to keep the generated classes private. For IP reasons. The dataaccessadapter was just an example, any ideas?

cheers a

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-May-2007 22:35:57   

As Frans said, if you don't want to reference directly your generated code at GUI, the best you can do is make a Manager layer that delivery the data and perform actions, for example:

EntityCollection<OrderEntity> OrdersManager.GetAllOrders();...

CustomersManager.SaveThisCustomer(CustomerEntity customer);...

so on...

However you will always need those EntityClasses if you want to take advantage of LLBLGen benefits. Unless you want (and I dont think so) work only with DataTables and passing native types (string, int, etc.) instead of EntityClasses.

I don't clearly understand your IP thing. Could you please elaborate more on your security request scenario?

David Elizondo | LLBLGen Support Team
dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 28-May-2007 00:56:22   

daelmo wrote:

EntityCollection<OrderEntity> OrdersManager.GetAllOrders();...

CustomersManager.SaveThisCustomer(CustomerEntity customer);...

so on...

That requires the Entity object too by the looks of it. Re: the IP issue, I was hoping I could consume entity objects on machines referencing our web service without requiring the "private" libraries used by us. The data layer is important to my client, and is practically the entire value of the product. I was just hoping to make it more private wink

..in only a few but important situations (without necessarily using datatables etc)...

cheers! a

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 28-May-2007 09:32:28   

That requires the Entity object too by the looks of it

You can also pass dataTables, native types as David said, or creating your own Data Transfer Objects.

Re: the IP issue, I was hoping I could consume entity objects on machines referencing our web service without requiring the "private" libraries used by us. The data layer is important to my client, and is practically the entire value of the product. I was just hoping to make it more private

If you are using the Adapter model. (which is made for these scenarioes): You may consume the DBGeneric classes and their Base classes on the ORMSupport...dll in the GUI Layer. And as long as the DBSpecific dll is not used in the GUI you are in good hands.