本文整理汇总了C#中IInformationObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IInformationObject.GetType方法的具体用法?C# IInformationObject.GetType怎么用?C# IInformationObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInformationObject
的用法示例。
在下文中一共展示了IInformationObject.GetType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeInformationObjectToBuffer
private static byte[] SerializeInformationObjectToBuffer(IInformationObject informationObject)
{
Type informationObjectType = informationObject.GetType();
using (MemoryStream memoryStream = new MemoryStream())
{
byte[] dataContent = null;
StorageSerializationType storageSerializationType = getStorageSerializationType(informationObjectType);
if (storageSerializationType == StorageSerializationType.XML)
{
DataContractSerializer ser = new DataContractSerializer(informationObjectType);
using (
XmlTextWriter writer = new XmlTextWriter(memoryStream, Encoding.UTF8)
{
Formatting = Formatting.Indented
})
{
ser.WriteObject(writer, informationObject);
writer.Flush();
dataContent = memoryStream.ToArray();
}
}
else if (storageSerializationType == StorageSerializationType.JSON)
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(informationObjectType);
serializer.WriteObject(memoryStream, informationObject);
dataContent = memoryStream.ToArray();
} else if (storageSerializationType == StorageSerializationType.Binary)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, informationObject);
dataContent = memoryStream.ToArray();
} else // if (storageSerializationType == StorageSerializationType.Custom)
{
throw new NotSupportedException("Custom or unspecified formatting not supported");
}
return dataContent;
}
}
示例2: ArgumentNullException
void IInformationObject.UpdateMasterValueTreeFromOtherInstance(IInformationObject sourceMaster)
{
if (sourceMaster == null)
throw new ArgumentNullException("sourceMaster");
if (GetType() != sourceMaster.GetType())
throw new InvalidDataException("Type mismatch in UpdateMasterValueTree");
IInformationObject iObject = this;
if(iObject.IsIndependentMaster == false)
throw new InvalidDataException("UpdateMasterValueTree called on non-master type");
if(ID != sourceMaster.ID)
throw new InvalidDataException("UpdateMasterValueTree is supported only on masters with same ID");
CopyContentFrom((NetworkUsageCollection) sourceMaster);
}
示例3: GetDefaultStaticTemplateName
public static string GetDefaultStaticTemplateName(IInformationObject informationObject)
{
string templateName = informationObject.GetType().FullName + "_DefaultView.phtml";
return templateName;
}
示例4: GetDefaultStaticViewName
public static string GetDefaultStaticViewName(IInformationObject informationObject)
{
string viewName = informationObject.GetType().FullName + "_" + informationObject.ID + "_DefaultView.phtml";
return viewName;
}
示例5: GetDefaultDynamicRenderingViewURL
private static string GetDefaultDynamicRenderingViewURL(IInformationObject informationObject)
{
string viewName = informationObject.GetType().FullName + "_DefaultView.phtml";
string viewItemLocation = informationObject.RelativeLocation;
string viewItemURL = RenderWebSupport.GetUrlFromRelativeLocation(viewItemLocation);
return viewName + "?viewItem=" + HttpUtility.UrlEncode(viewItemURL);
}
示例6: SetReferenceSubscriptionToMaster
public static void SetReferenceSubscriptionToMaster(IInformationObject containerObject, IInformationObject referenceInstance, IInformationObject masterInstance)
{
AddSubscriptionToObject(masterInstance.RelativeLocation, containerObject.RelativeLocation, SubscribeType_MasterToReferenceUpdate, targetTypeName:masterInstance.GetType().FullName,
subscriberTypeName:containerObject.GetType().FullName);
}
示例7: SetCollectionSubscriptionToMaster
public static void SetCollectionSubscriptionToMaster(IInformationObject containerObject, string masterCollectionLocation, Type collectionType)
{
AddSubscriptionToObject(masterCollectionLocation, containerObject.RelativeLocation, SubscribeType_MasterCollectionToContainerUpdate, collectionType.FullName,
containerObject.GetType().FullName);
}
示例8: SemanticInformationItem
public SemanticInformationItem(IInformationObject informationObject)
{
ItemFullType = informationObject.GetType().FullName;
ItemValue = informationObject.RelativeLocation;
}
示例9: 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;
}
}