本文整理汇总了C#中Session.GetKeyValue方法的典型用法代码示例。如果您正苦于以下问题:C# Session.GetKeyValue方法的具体用法?C# Session.GetKeyValue怎么用?C# Session.GetKeyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.GetKeyValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAuditTrail
XPBaseCollection GetAuditTrail(Session session, XPBaseObject xpBaseObject, Type auditedObjectWeakReferenceType) {
var binaryOperator = new BinaryOperator("TargetType", session.GetObjectType(xpBaseObject));
var operands = new BinaryOperator("TargetKey", XPWeakReference.KeyToString(session.GetKeyValue(xpBaseObject)));
var auditObjectWR = (XPWeakReference) session.FindObject(auditedObjectWeakReferenceType,new GroupOperator(binaryOperator,operands));
if (auditObjectWR != null) {
var baseCollection = (XPBaseCollection) auditObjectWR.ClassInfo.GetMember("AuditDataItems").GetValue(auditObjectWR);
baseCollection.BindingBehavior = CollectionBindingBehavior.AllowNone;
return baseCollection;
}
return null;
}
示例2: GetAuditTrail
public static XPCollection<XpandAuditDataItemPersistent> GetAuditTrail(Session session, object obj){
var auditObjectWr = session.FindObject<XpandAuditedObjectWeakReference>(
new GroupOperator(
new BinaryOperator("TargetType", session.GetObjectType(obj)),
new BinaryOperator("TargetKey", KeyToString(session.GetKeyValue(obj)))
));
if (auditObjectWr != null){
auditObjectWr.AuditDataItems.BindingBehavior = CollectionBindingBehavior.AllowNone;
return auditObjectWr.AuditDataItems;
}
return null;
}
示例3: Create
public static IExceptionObject Create(Session session, Exception exception, XafApplication application) {
var findBussinessObjectType = XafTypesInfo.Instance.FindBussinessObjectType<IExceptionObject>();
var exceptionObject = (IExceptionObject)ReflectionHelper.CreateObject(findBussinessObjectType, new[] { session });
if (application != null)
exceptionObject.Application = application.ApplicationName;
exceptionObject.ComputerName = Environment.MachineName;
exceptionObject.Date = DateTime.Today;
exceptionObject.FullException = exception.ToString();
exceptionObject.Message = exception.Message;
exceptionObject.Screenshot = GetScreenShot();
exceptionObject.ThreadID = Thread.CurrentThread.Name;
exceptionObject.Time = DateTime.Now.TimeOfDay;
var user = ((IUser)SecuritySystem.CurrentUser);
if (user != null)
exceptionObject.UserId = (Guid)session.GetKeyValue(user);
exceptionObject.TracingLastEntries = Tracing.Tracer.GetLastEntriesAsString();
var windowsIdentity = WindowsIdentity.GetCurrent();
if (windowsIdentity != null) exceptionObject.WindowsID = windowsIdentity.Name;
if (exception.InnerException != null)
exceptionObject.InnerExceptionObjects.Add(Create(session, exception.InnerException, application));
return exceptionObject;
}
示例4: SetObject
/// <summary>
/// Устанавливает ссылку на объект
/// </summary>
/// <param name="session">Сессия для хранения и загрузки хранимых объектов</param>
/// <param name="value">Объект, на который устанавливается ссылка</param>
/// <exception cref="ArgumentException">Попытка установить ссылку на несохраненный объект</exception>
public void SetObject(Session session, object value)
{
if (value == null)
TargetKeyValue = null;
else if (session.IsNewObject(value))
throw new ArgumentException("Referenced saved object expected");
else
TargetKeyValue = session.GetKeyValue(value);
}