本文整理汇总了C#中IContainerOwner.IsMyEditableContent方法的典型用法代码示例。如果您正苦于以下问题:C# IContainerOwner.IsMyEditableContent方法的具体用法?C# IContainerOwner.IsMyEditableContent怎么用?C# IContainerOwner.IsMyEditableContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContainerOwner
的用法示例。
在下文中一共展示了IContainerOwner.IsMyEditableContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleOwnerPostRequest
private void HandleOwnerPostRequest(IContainerOwner containerOwner, HttpContext context, string contentPath)
{
HttpRequest request = context.Request;
var form = request.Unvalidated().Form;
bool isCancelButton = form["btnCancel"] != null;
if (isCancelButton)
return;
string actionName = form["RootSourceAction"];
if(actionName != "Save")
{
var result = PerformWebAction.Execute(new PerformWebActionParameters
{
CommandName = actionName,
FormSubmitContent = form,
Owner = containerOwner,
});
return;
}
string submittedObjectList = form["BoundObject"];
string[] submittedObjects = submittedObjectList.Split(',');
foreach (string submittedObject in submittedObjects)
{
string[] objectWithETag = submittedObject.Split(':');
string relativeLocation = objectWithETag[0];
string eTag = null;
if (objectWithETag.Length == 2)
eTag = objectWithETag[1];
try
{
if (containerOwner.IsMyEditableContent(relativeLocation) == false)
throw new SecurityException("Content not allowed to edit in this security context: " +
relativeLocation);
CloudBlob blob = StorageSupport.CurrActiveContainer.GetBlob(relativeLocation);
string objectType = blob.GetBlobInformationObjectType();
IInformationObject rootObject = StorageSupport.RetrieveInformation(relativeLocation, objectType,
eTag: eTag);
/* Temporarily removed all the version checks - last save wins!
if (oldETag != rootObject.ETag)
{
RenderWebSupport.RefreshContent(webPageBlob);
throw new InvalidDataException("Information under editing was modified during display and save");
}
* */
// TODO: Proprely validate against only the object under the editing was changed (or its tree below)
rootObject.SetValuesToObjects(form);
// TODO: Media support through operation
/*
// If not add operation, set media content to stored object
foreach (string contentID in request.Files.AllKeys)
{
HttpPostedFile postedFile = request.Files[contentID];
if (String.IsNullOrWhiteSpace(postedFile.FileName))
continue;
rootObject.SetMediaContent(containerOwner, contentID, postedFile);
}
* */
rootObject.StoreInformationMasterFirst(containerOwner, false);
}
catch (StorageException stEx)
{
if (stEx.StatusCode == HttpStatusCode.PreconditionFailed)
{
throw new DBConcurrencyException(
string.Format("Optimistic Concurrency Failed (Object: {0} ETag: {1})", relativeLocation,
eTag));
}
throw;
}
}
}