Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ICustomerAccountCalculation
- {
- Decimal Balance(int customerId);
- }
- public interface ICustomerAccountCalculation
- {
- Decimal Balance(Customer customer);
- }
- decimal balance = from c in Customers
- where c.CustomerId == customerId
- select c.Balance;
- // caller with the object already loaded
- productService.process(product);
- // caller without the object loaded
- productService.process(new Product(productId));
- // service method
- void process(Product product) {
- // Ensure product is loaded, only if we need more fields.
- // We could extract this to a helper method.
- if (!product.isLoaded()) {
- product = database.getProduct(product.getId());
- }
- ...
- }
Add Comment
Please, Sign In to add comment