When you do code, please avoid declaring the not read-only variable as private property for a class. For example:

If your user reports a bug, then when you want to search for the root cause of the problem, it will be challenging because it is tedious to check.

Suggestion
For maintainability purposes, always remember KISS (Keep It Simple Stupid) principle. So for solving that problem, this is how I do it:
internal class RoomReservationHelper
{
private readonly IPluginExecutionContext _context;
private readonly IOrganizationService _service;
private readonly IOrganizationServiceFactory _serviceFactory;
public RoomReservationHelper(IPluginExecutionContext context,
IOrganizationServiceFactory serviceFactory, IOrganizationService service)
{
_context = context;
_serviceFactory = serviceFactory;
_service = service;
}
public void Execute()
{
var roomReservation = (Entity)_context.InputParameters["Target"];
var resvNo = roomReservation.Attributes["gent_name"].ToString();
var anotherRoomReservations = GetRelatedRoomReservation(roomReservation);
}
private Entity[] GetRelatedRoomReservation(Entity roomReservation)
{
var name = roomReservation.Attributes["gent_name"].ToString();
var number = .Attributes["gent_roomnumber"].ToString();
...
}
}
The Changes?
- We define the variable when it’s needed.
- We break 1 function into a smaller function. Make it more clear, more readable.
- All the property of the class is read-only, so this makes sure you’re class is thread-safe.