# createService

Create a virtual service for a specific entity. Basically a new service layer that inherits from the `BaseORMService` object but no need to pass in entity names, they are bound to the entity name passed here.

## Returns

* This function returns *VirtualEntityService*

## Arguments

| Key              | Type    | Required | Default                    |
| ---------------- | ------- | -------- | -------------------------- |
| entityName       | string  | Yes      | ---                        |
| useQueryCaching  | boolean | No       | Same as BaseService        |
| queryCacheRegion | string  | No       | Same as BaseService        |
| eventHandling    | boolean | No       | true                       |
| useTransactions  | boolean | No       | true                       |
| defaultAsQuery   | boolean | No       | true                       |
| datasource       | string  | No       | The default app datasource |

## Examples

```javascript
userService = ormService.createService("User");
userService = ormService.createService("User",true);
userService = ormService.createService("User",true,"MyFunkyUserCache");

// Remember you can use virtual entity services by autowiring them in via our DSL
component{
  property name="userService" inject="entityService:User";
  property name="postService" inject="entityService:Post";    
}
```


---

# 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://coldbox-orm.ortusbooks.com/v2.x-2/base-orm-service-1/service-methods/utility-methods/createservice.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.
