Coding Standards/Best Practices

Posts   
 
    
caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 17-Dec-2007 17:52:28   

Hello --

I'm looking to add LLBLGen specific coding standards/best practices to our coding conventions document. (99.9% of our projects are in C#.)

I've read the "Best Practices" section of the LLBLGen manual and I'm wondering if there are any other practices or standards that you all follow.

Some of the things I'm thinking of are:

  1. Self Servicing:
    • prefetch data when you are binding a lot of records; for example a report
  2. Use operator overloading instead of Predicate factories
  3. Use entity views instead of foreach loops
  4. Adapter:
    • make sure a related entity isn't null in case it wasn't prefetched; e.g.

 if (customer.Account != null) 
   foo = customer.Account.ContactName;

I'd appreciate any comments or suggestions.

Thanks.

gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 17-Dec-2007 18:48:19   

Hi,

I would say think of a consistent way of naming fields, "fields on relations" and "fields on related fields". You find those in the designer when editing the options of an entity.

You can also preconfigure this partly in your project configuration file.

For example with Order, Orderdetails and a Customer:

How to name the property Orderdetails: - Order.Orderdetail, or - Order.Orderdetails, or Order.OrderdetailCollection

Or for a related Customer to a Order: - Order.Customer, or - Order.CustomerEntity

Also for fields on related fields, for the Customer.Name: - Order.CustomerName - Order.CustomerEntityName - Order.Customer

I think you can imagine from here what to think of and what sounds logical to you.

Cheers, Gab