本文整理汇总了C#中INakedObject.GetDomainObject方法的典型用法代码示例。如果您正苦于以下问题:C# INakedObject.GetDomainObject方法的具体用法?C# INakedObject.GetDomainObject怎么用?C# INakedObject.GetDomainObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INakedObject
的用法示例。
在下文中一共展示了INakedObject.GetDomainObject方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reset
public void Reset(INakedObject inObject) {
try {
var collection = (IList) property.GetValue(inObject.GetDomainObject(), null);
collection.Clear();
property.SetValue(inObject.GetDomainObject(), collection, null);
}
catch (Exception e) {
throw new ReflectionException(string.Format("Failed to get/set property {0} in {1}", property.Name, inObject.Specification.FullName), e);
}
}
示例2: SetProperty
public override void SetProperty(INakedObject nakedObject, INakedObject value) {
try {
property.SetValue(nakedObject.GetDomainObject(), value.GetDomainObject(), null);
}
catch (TargetInvocationException e) {
InvokeUtils.InvocationException("Exception executing " + property, e);
}
}
示例3: GetProperty
public override object GetProperty(INakedObject nakedObject) {
try {
return propertyMethod.GetValue(nakedObject.GetDomainObject(), null);
}
catch (TargetInvocationException e) {
InvokeUtils.InvocationException("Exception executing " + propertyMethod, e);
return null;
}
}
示例4: Init
public override void Init(INakedObject collection, INakedObject[] initData) {
Array newCollection = Array.CreateInstance(collection.GetDomainObject().GetType().GetElementType(), initData.Length);
collection.ReplacePoco(newCollection);
int i = 0;
foreach (INakedObject nakedObject in initData) {
AsCollection(collection)[i++] = nakedObject.Object;
}
}
示例5: IsEditView
public override bool IsEditView(INakedObject nakedObject) {
var target = nakedObject.GetDomainObject<IViewModelSwitchable>();
if (target != null) {
return target.IsEditView();
}
throw new NakedObjectSystemException(nakedObject.Object == null ? "Null domain object" : "Wrong type of domain object: " + nakedObject.Object.GetType().FullName);
}
示例6: Invoke
public void Invoke(INakedObject nakedObject, INakedObject[] parameters, bool queryOnly, IIdentifier identifier) {
Init();
IAuditor auditor = GetNamespaceAuthorizerFor(nakedObject) ?? defaultAuditor;
if (nakedObject.Specification.IsService) {
string serviceName = nakedObject.Specification.GetTitle(nakedObject);
auditor.ActionInvoked(NakedObjectsContext.Session.Principal, identifier.MemberName, serviceName, queryOnly, parameters.Select(no => no.GetDomainObject()).ToArray());
}
else {
auditor.ActionInvoked(NakedObjectsContext.Session.Principal, identifier.MemberName, nakedObject.GetDomainObject(), queryOnly, parameters.Select(no => no.GetDomainObject()).ToArray());
}
}
示例7: GetCompletions
public override object[] GetCompletions(INakedObject inObject, string autoCompleteParm) {
try {
object autoComplete = InvokeUtils.Invoke(method, inObject.GetDomainObject(), new object[] {autoCompleteParm});
if (autoComplete is IQueryable) {
return ((IQueryable) autoComplete).Take(PageSize).ToArray();
}
throw new NakedObjectDomainException("Must return IQueryable from autoComplete method: " + method.Name);
}
catch (ArgumentException ae) {
string msg = string.Format("autoComplete exception: {0} has mismatched parameter type - must be string", method.Name);
throw new InvokeException(msg, ae);
}
}
示例8: UnwrapString
/// <summary>
/// For convenience of subclass facets that implement
/// <see cref="IValidatingInteractionAdvisor" />, <see cref="IHidingInteractionAdvisor" /> or
/// <see cref="IDisablingInteractionAdvisor" />
/// </summary>
protected internal virtual string UnwrapString(INakedObject nakedObject) {
object obj = nakedObject.GetDomainObject();
if (obj == null) {
return null;
}
if (!(obj is string)) {
return null;
}
return (string) obj;
}
示例9: Invoke
public static object Invoke(MethodInfo method, INakedObject nakedObject) {
var parameters = new object[method.GetParameters().Length];
return Invoke(method, nakedObject.GetDomainObject(), parameters);
}
示例10: Persisted
public void Persisted(INakedObject nakedObject) {
Init();
IAuditor auditor = GetNamespaceAuthorizerFor(nakedObject) ?? defaultAuditor;
auditor.ObjectPersisted(NakedObjectsContext.Session.Principal, nakedObject.GetDomainObject());
}
示例11: GetBooleanFieldValue
private static string GetBooleanFieldValue(this HtmlHelper html, INakedObject valueNakedObject) {
var state = valueNakedObject.GetDomainObject<bool?>();
string src = "Images/unset.png";
string alt = MvcUi.TriState_NotSet;
if (state.HasValue) {
if (state.Value) {
src = "Images/checked.png";
alt = MvcUi.TriState_True;
}
else {
src = "Images/unchecked.png";
alt = MvcUi.TriState_False;
}
}
var tag = new TagBuilder("img");
tag.MergeAttribute("src", src);
tag.MergeAttribute("alt", alt);
return tag.ToString();
}