本文整理汇总了C#中IInformationObject类的典型用法代码示例。如果您正苦于以下问题:C# IInformationObject类的具体用法?C# IInformationObject怎么用?C# IInformationObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IInformationObject类属于命名空间,在下文中一共展示了IInformationObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReferenceOutdatedException
public ReferenceOutdatedException(IInformationObject containerObject, IInformationObject referenceInstance, IInformationObject masterInstance)
{
// TODO: Complete member initialization
this.containerObject = containerObject;
this.referenceInstance = referenceInstance;
this.masterInstance = masterInstance;
}
示例2: InitializeChainAndReturnPropertyOwningObject
public static void InitializeChainAndReturnPropertyOwningObject(IInformationObject createdObject, string objectProp, out object actualContainingObject, out string fieldPropertyName)
{
actualContainingObject = null;
fieldPropertyName = null;
if (objectProp.Contains("___") == false)
return;
string[] objectChain = objectProp.Split(new[] { "___" }, StringSplitOptions.None);
fieldPropertyName = objectChain[objectChain.Length - 1];
Stack<string> objectChainStack = new Stack<string>(objectChain.Reverse().Skip(1));
actualContainingObject = createdObject;
while (objectChainStack.Count > 0)
{
Type currType = actualContainingObject.GetType();
string currObjectProp = objectChainStack.Pop();
PropertyInfo prop = currType.GetProperty(currObjectProp);
if (prop == null)
throw new InvalidDataException("Property not found by name: " + currObjectProp);
var currPropValue = prop.GetValue(actualContainingObject, null);
if (currPropValue == null)
{
var currPropType = prop.PropertyType;
currPropValue = Activator.CreateInstance(currPropType);
prop.SetValue(actualContainingObject, currPropValue, null);
}
actualContainingObject = currPropValue;
}
}
示例3: getOrCreateInformationObjectsTextContent
private static TextContent getOrCreateInformationObjectsTextContent(Process process, IInformationObject sourceObject)
{
var processItems = process.ProcessItems;
var matchingProcessItem = processItems.FirstOrDefault(processItem => processItem.Inputs.Any(sourceObject.IsObjectsSemanticItem));
TextContent result = null;
if (matchingProcessItem != null)
{
var matchingOutput = matchingProcessItem.Outputs.FirstOrDefault(semanticItem => semanticItem.ItemFullType == typeof (TextContent).FullName);
if (matchingOutput != null)
{
var textContentLocation = matchingOutput.ItemValue;
result = TextContent.RetrieveTextContent(textContentLocation, Owner);
}
if (result == null)
{
processItems.Remove(matchingProcessItem);
matchingProcessItem = null;
}
}
if(matchingProcessItem == null)
{
matchingProcessItem = new ProcessItem();
matchingProcessItem.Inputs.Add(new SemanticInformationItem(sourceObject));
TextContent textContent = new TextContent();
textContent.SetLocationAsOwnerContent(Owner, textContent.ID);
textContent.GeneratedByProcessID = process.ID;
matchingProcessItem.Outputs.Add(new SemanticInformationItem(textContent));
processItems.Add(matchingProcessItem);
result = textContent;
}
return result;
}
示例4: ExecuteMethod_DeleteObjects
public static void ExecuteMethod_DeleteObjects(IInformationObject[] processingResultsToDelete)
{
if (processingResultsToDelete == null)
return;
foreach(var iObj in processingResultsToDelete)
iObj.DeleteInformationObject();
}
示例5: ExecuteMethod_StoreObjects
public static void ExecuteMethod_StoreObjects(IInformationObject[] processingResultsToStore)
{
if (processingResultsToStore == null)
return;
foreach (var iObj in processingResultsToStore)
iObj.StoreInformation();
}
示例6: ExecuteMethod_CreateInternalObjects
public static void ExecuteMethod_CreateInternalObjects(IInformationObject rootObject, NameValueCollection httpFormData)
{
var internalObjectProperties = httpFormData.AllKeys.Where(key => key.Contains("___")).ToArray();
foreach (var objectProp in internalObjectProperties)
{
initializeChainObjects(rootObject, objectProp);
}
}
示例7: SetObjectValues_GetParameters
public static SetObjectTreeValuesParameters SetObjectValues_GetParameters(NameValueCollection httpFormData, HttpFileCollection httpFileData, IInformationObject createdObject)
{
return new SetObjectTreeValuesParameters
{
RootObject = createdObject,
HttpFormData = httpFormData,
HttpFileData = httpFileData
};
}
示例8: ExecuteMethod_SetBinaryContent
public static void ExecuteMethod_SetBinaryContent(IInformationObject rootObject, Dictionary<string, MediaFileData> binaryContentFiles)
{
foreach (var fileKey in binaryContentFiles.Keys)
{
string contentInfo = fileKey.Substring(5); // Substring("File_".Length);
ModifyInformationSupport.SetBinaryContent(InformationContext.CurrentOwner, contentInfo, rootObject,
binaryContentFiles[fileKey]);
}
}
示例9: CreateDefaultViewRelativeToRequester
/// <summary>
/// Creates default views and returns the one relative to the requester
/// </summary>
/// <param name="requesterLocation">Requester relative location</param>
/// <param name="informationObject">Information object to create the view for</param>
/// <param name="owner">Container owner</param>
/// <returns></returns>
public static CloudBlob CreateDefaultViewRelativeToRequester(string requesterLocation, IInformationObject informationObject, IContainerOwner owner)
{
bool isAccountOwner = owner.IsAccountContainer();
bool isGroupOwner = owner.IsGroupContainer();
bool isDeveloperView = owner.ContainerName == "dev";
string[] viewLocations;
if (isAccountOwner)
viewLocations = FixedAccountSiteLocations;
else if (isGroupOwner)
viewLocations = FixedGroupSiteLocations;
else throw new NotSupportedException("Invalid owner container type for default view (non acct, non group): " + owner.ContainerName);
string requesterDirectory = StorageSupport.GetLocationParentDirectory(requesterLocation);
FileInfo fileInfo = new FileInfo(requesterLocation);
//string viewRoot = fileInfo.Directory.Parent != null
// ? fileInfo.Directory.Parent.Name
// : fileInfo.Directory.Name;
CloudBlob relativeViewBlob = null;
bool hasException = false;
bool allException = true;
foreach (string viewLocation in viewLocations)
{
try
{
string viewRoot = isDeveloperView ? "developer-00000000000000000000000000" : GetViewRoot(viewLocation);
string viewItemDirectory = Path.Combine(viewRoot, viewLocation).Replace("\\", "/") + "/";
string viewName = GetDefaultStaticViewName(informationObject);
string viewTemplateName = GetDefaultStaticTemplateName(informationObject);
// TODO: Relative from xyzsite => xyztemplate; now we only have website - also acct/grp specific
//string viewTemplateLocation = "webtemplate/oip-viewtemplate/" + viewTemplateName;
string viewTemplateLocation = viewItemDirectory + viewTemplateName;
CloudBlob viewTemplate = StorageSupport.CurrActiveContainer.GetBlob(viewTemplateLocation, owner);
string renderedViewLocation = viewItemDirectory + viewName;
CloudBlob renderTarget = StorageSupport.CurrActiveContainer.GetBlob(renderedViewLocation, owner);
InformationSource defaultSource = InformationSource.GetAsDefaultSource(informationObject);
RenderWebSupport.RenderTemplateWithContentToBlob(viewTemplate, renderTarget, defaultSource);
if (viewItemDirectory == requesterDirectory)
relativeViewBlob = renderTarget;
allException = false;
}
catch (Exception ex)
{
hasException = true;
}
}
if (relativeViewBlob == null && hasException == false && false)
throw new InvalidDataException(
String.Format("Default view with relative location {0} not found for owner type {1}",
requesterLocation, owner.ContainerName));
return relativeViewBlob;
}
示例10: ExecuteMethod_AddEncodedFormDataToBinaryFiles
public static void ExecuteMethod_AddEncodedFormDataToBinaryFiles(IInformationObject rootObject, NameValueCollection httpFormData, Dictionary<string, MediaFileData> binaryContentFiles)
{
const string base64CommaValue = "base64,";
const int base64Length = 7; // base64CommaValue.Length;
string objectID = rootObject.ID;
foreach (var key in httpFormData.AllKeys)
{
if (key.StartsWith("FileEmbedded_"))
{
string dictKey = prefixWithIDIfMissing(key, "FileEmbedded_", objectID);
dictKey = dictKey.Replace("FileEmbedded_", "File_");
string formValue = httpFormData[key];
MediaFileData mediaFileData = null;
if (String.IsNullOrEmpty(formValue) == false)
{
int fileNameEndIX = formValue.IndexOf(':');
string fileName = formValue.Substring(0, fileNameEndIX);
fileName = Path.GetFileName(fileName);
int base64CommaIX = formValue.IndexOf(base64CommaValue, System.StringComparison.Ordinal);
var base64Data = formValue.Substring(base64CommaIX + base64Length);
// Strip off remaining comma separated datas in case the field value has those
var existingDataCommaIX = base64Data.IndexOf(',');
if (existingDataCommaIX > 0)
base64Data = base64Data.Substring(0, existingDataCommaIX);
byte[] realData = Convert.FromBase64String(base64Data);
mediaFileData = new MediaFileData
{
FileName = fileName,
FileContent = realData
};
}
binaryContentFiles.Add(dictKey, mediaFileData);
}
}
}
示例11: GetTarget_BinaryContentFiles
public static Dictionary<string, MediaFileData> GetTarget_BinaryContentFiles(IInformationObject rootObject, NameValueCollection httpFormData, HttpFileCollection httpFileData)
{
if (httpFileData == null)
return new Dictionary<string, MediaFileData>();
Dictionary<string, MediaFileData> resultDict = new Dictionary<string, MediaFileData>(httpFileData.Count);
string objectID = rootObject.ID;
foreach (var key in httpFormData.AllKeys)
{
if (key.StartsWith("File_"))
{
HttpPostedFile httpFile = null;
if (httpFileData.AllKeys.Contains(key))
httpFile = httpFileData[key];
string dictKey = prefixWithIDIfMissing(key, "File_", objectID);
resultDict.Add(dictKey, httpFile != null ? new MediaFileData { HttpFile = httpFile} : null);
}
}
foreach (var key in httpFileData.AllKeys)
{
if (key.StartsWith("File_"))
{
string dictKey = prefixWithIDIfMissing(key, "File_", objectID);
if (resultDict.ContainsKey(dictKey) == false)
{
var httpFile = httpFileData[key];
resultDict.Add(dictKey, httpFile != null ? new MediaFileData { HttpFile = httpFile } : null);
}
}
}
return resultDict;
}
示例12: ExecuteMethod_SetObjectLinks
public static void ExecuteMethod_SetObjectLinks(IInformationObject rootObject, NameValueCollection objectLinkValues)
{
ModifyInformationSupport.SetObjectLinks(rootObject, objectLinkValues);
}
示例13: ExecuteMethod_StoreCompleteObject
public static void ExecuteMethod_StoreCompleteObject(IInformationObject rootObject)
{
rootObject.StoreInformationMasterFirst(InformationContext.CurrentOwner, false);
}
示例14:
void IInformationObject.ReplaceObjectInTree(IInformationObject replacingObject)
{
if(TimeRange != null) {
if(TimeRange.ID == replacingObject.ID)
TimeRange = (TimeRange) replacingObject;
else {
IInformationObject iObject = TimeRange;
iObject.ReplaceObjectInTree(replacingObject);
}
}
}
示例15: ExecuteMethod_SetFieldValues
public static void ExecuteMethod_SetFieldValues(IInformationObject rootObject, NameValueCollection fieldValues)
{
ModifyInformationSupport.SetFieldValues(rootObject, fieldValues);
}