Overview
The virtual entity service is another support class that can help you create virtual service layers that are bounded to a specific ORM entity for convenience. This class inherits from our Base ORM Service and allows you to do everything the base class provides, except you do not need to specify to which entityName
or entity
you are working with.
![](https://coldbox-orm.ortusbooks.com/~gitbook/image?url=https%3A%2F%2Fgithub.com%2FColdBox%2Fcbox-cborm%2Fwiki%2FVirtualEntityService.jpg&width=768&dpr=4&quality=100&sign=68e7f90f&sv=1)
You can also use this class as a base class and template out its methods to more concrete usages. The idea behind this virtual entity service layer is to allow you to have a very nice abstraction to all the CF ORM capabilities (hibernate) and promote best practices.
Tip: Please remember that you can use ANY method found in the Base ORM Service except that you will not pass an argument of entityName
anymore as you have now been bounded to that specific entity.
Injection Virtual Services
The WireBox injection DSL has an injection namespace called entityService
that can be used to wire in a Virtual Entity Service bound to ANY entity in your application. You will use this DSL in conjunction with the name of the entity to manage it.
Inject Content | Description |
| A virtual service based on the |
Requesting Virtual Services
You can also request a virtual service via the getInstance()
method in your handlers or view a wirebox.getInstance()
call:
Mapping Virtual Services
You can also leverage the WireBox Binder to map your virtual services so you can abstract the object's constructions or add constructor arguments to their definition and have full control:
Now you can just use it via the UserService
alias:
Last updated