Is there any way to specify that one entity is dependent on another entity?

I have two entities A and B.
A has a machine name, while B has a field that contains the machine name of A it belongs to.
There can be a number of B entities that belongs to a single A entity.
I need to:
1) Delete corresponding B entities when I delete the A entity.
2) Possibility to export dependent B entities together with A entity (and import them back).
3) Access B entities through A entity as it is possible with fields. I partially succeeded to achieve this with getter/setter callbacks in hook_entity_property_info().

Can someone point me to a good example/doc of implementation for such a dependency. Should it be implemented at the level of Entity or controller?