/// <summary> /// Persist the entity to the storage /// </summary> public bool Persist(PenneoConnector con) { con.Log((IsNew ? "Creating" : "Updating") + " " + GetType().Name + " (" + (Id.HasValue ? Id.ToString() : "new") + ")", LogSeverity.Information); var success = con.ApiConnector.WriteObject(this); if (!success) { con.Log((IsNew ? "Creating" : "Updating") + " " + GetType().Name + " (" + (Id.HasValue ? Id.ToString() : "new") + ") failed", LogSeverity.Information); } return(success); }
/// <summary> /// Unlink this entity with the given child in the storage /// </summary> protected bool UnlinkEntity(PenneoConnector con, Entity child) { con.Log("Unlinking " + GetType().Name + " (" + (Id.HasValue ? Id.ToString() : "new") + ") TO " + child.GetType().Name + " (" + (child.Id.HasValue ? Id.ToString() : "new") + ")", LogSeverity.Information); return(con.ApiConnector.UnlinkEntity(this, child)); }
/// <summary> /// Delete the entity from the storage /// </summary> public void Delete(PenneoConnector con) { con.Log("Deleting " + GetType().Name + " (" + (Id.HasValue ? Id.ToString() : "new") + ")", LogSeverity.Information); if (!con.ApiConnector.DeleteObject(this)) { throw new Exception("Penneo: Could not delete the " + GetType().Name); } Id = null; }
public QuerySingleObjectResult <T> FindOneBy <T>(QueryInput input) where T : Entity { _con.Log("FindOneBy (" + typeof(T).Name + ")", LogSeverity.Information); var result = new QuerySingleObjectResult <T>(FindBy <T>(input)); return(result); }