private OmniaEntityWrapper(OmniaClient omniaClient, EntityMetadata entityMetadata) { _omniaClient = omniaClient; _entityMetadata = entityMetadata; _presentationEntity = Activator.CreateInstance <T>(); _synchronizedEntity = Activator.CreateInstance <T>(); }
public static async Task <OmniaEntityWrapper <T> > Create(OmniaClient omniaClient, EntityMetadata entityMetadata, string code = null) { var entityWrapper = new OmniaEntityWrapper <T>(omniaClient, entityMetadata); if (string.IsNullOrEmpty(code)) { var temporary = await omniaClient.CreateTemporary(entityMetadata); entityWrapper.ApplyInitialJsonPatchDocument(temporary.id, temporary.data); } else { var temporary = await omniaClient.CreateTemporary <T>(entityMetadata, code); entityWrapper.ApplyInitialDocument(temporary.id, temporary.data); } return(entityWrapper); }