# Adding to Facades

If you do encounter the need to implement custom selectors, it is highly recommended that you integrate them into your entity facades, rather than consume them directly from components. This does of course assume you are using entity facades, and if you have foregone the use of facades then you may use custom selectors as you normally do with @ngrx.&#x20;

### Property or Accessor Method

After creating a custom selector, you will need to determine whether a property or accessor method is appropriate for this new selector in your facade. For non-parameterized selectors, a property is usually most appropriate.&#x20;

For parameterized selectors, an accessor method may be more appropriate. If however the possible range of input to your parameters is limited then multiple properties that each encompass a particular use case might still be the best option.

### Adding a Custom Property&#x20;

Continuing on with our `firstCustomer` selector from the previous section, adding this to a `CustomerFacade` should be very strait forward:

{% code title="customer.facade.ts" %}

```typescript
import {firstCustomer, CustomerFacadeBase} from 'state/customer.state';
import {Customer} from 'models';

export class CustomerFacade extends CustomerFacadeBase {
    constructor(store: Store<AppState>) {
        super(Customer, store);
    }
    
    get firstCustomer$(): Observable<Customer> {
        return this.store.pipe(select(firstCustomer));
    }
}
```

{% endcode %}

### Adding a Custom Accessor Method

With a parameterized selector like our prior `customerById` example, we should use a method instead of a property to allow passing in the id of the customer to select:

{% code title="customer.facade.ts" %}

```typescript
import {firstCustomer, customerByName, CustomerFacadeBase} from 'state/customer.state';
import {Customer} from 'models';

export class CustomerFacade extends CustomerFacadeBase {
    constructor(store: Store<AppState>) {
        super(Customer, store);
    }
    
    get firstCustomer$(): Observable<Customer> {
        return this.store.pipe(select(firstCustomer));
    }
    
    customerByName$(name: string): Observable<Customer> {
        return this.store.pipe(select(customerByName, {name});
    }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://briebug.gitbook.io/ngrx-auto-entity/0.4.x/advanced/usage/custom-selectors/adding-to-facades.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
