当前位置: 首页>>代码示例>>C#>>正文


C# INakedObjectAdapter.GetDomainObject方法代码示例

本文整理汇总了C#中INakedObjectAdapter.GetDomainObject方法的典型用法代码示例。如果您正苦于以下问题:C# INakedObjectAdapter.GetDomainObject方法的具体用法?C# INakedObjectAdapter.GetDomainObject怎么用?C# INakedObjectAdapter.GetDomainObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INakedObjectAdapter的用法示例。


在下文中一共展示了INakedObjectAdapter.GetDomainObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Reset

 public void Reset(INakedObjectAdapter inObjectAdapter) {
     try {
         var collection = (IList) property.GetValue(inObjectAdapter.GetDomainObject(), null);
         collection.Clear();
         property.SetValue(inObjectAdapter.GetDomainObject(), collection, null);
     }
     catch (Exception e) {
         throw new ReflectionException(string.Format("Failed to get/set property {0} in {1}", property.Name, inObjectAdapter.Spec.FullName), e);
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:10,代码来源:CollectionResetFacet.cs

示例2: Reset

 public void Reset(INakedObjectAdapter inObjectAdapter) {
     try {
         var collection = (IList) property.GetValue(inObjectAdapter.GetDomainObject(), null);
         collection.Clear();
         property.SetValue(inObjectAdapter.GetDomainObject(), collection, null);
     }
     catch (Exception e) {
         throw new ReflectionException(Log.LogAndReturn($"Failed to get/set property {property.Name} in {inObjectAdapter.Spec.FullName}"), e);
     }
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:10,代码来源:CollectionResetFacet.cs

示例3: GetTitleWithMask

        public override string GetTitleWithMask(string mask, INakedObjectAdapter nakedObjectAdapter, INakedObjectManager nakedObjectManager) {
            if (maskDelegate != null) {
                return (string) maskDelegate(nakedObjectAdapter.GetDomainObject(), new object[] {mask});
            }

            if (maskMethod != null) {
                return (string) maskMethod.Invoke(nakedObjectAdapter.GetDomainObject(), new object[] {mask});
            }

            return GetTitle(nakedObjectAdapter, nakedObjectManager);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:11,代码来源:TitleFacetViaToStringMethod.cs

示例4: HiddenReason

 public string HiddenReason(INakedObjectAdapter nakedObjectAdapter) {
     if (nakedObjectAdapter == null) {
         return null;
     }
     var isHidden = (bool) methodDelegate(nakedObjectAdapter.GetDomainObject(), new object[] {});
     return isHidden ? Resources.NakedObjects.Hidden : null;
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:HideForContextFacet.cs

示例5: GetCompletions

        public object[] GetCompletions(INakedObjectAdapter inObjectAdapter, string autoCompleteParm) {
            try {
                object autoComplete = methodDelegate(inObjectAdapter.GetDomainObject(), new object[] { autoCompleteParm });

                //returning an IQueryable
                var queryable = autoComplete as IQueryable;
                if (queryable != null) {
                    return queryable.Take(PageSize).ToArray();
                }
                //returning an IEnumerable (of string only)
                var strings = autoComplete as IEnumerable<string>;
                if (strings != null) {
                    return strings.ToArray();
                }
                //return type is a single object
                if (!CollectionUtils.IsCollection(autoComplete.GetType())) {
                    return new object[] { autoComplete };
                }
                throw new NakedObjectDomainException("Must return IQueryable or a single object 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);
            }
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:25,代码来源:AutoCompleteFacet.cs

示例6: InvalidReason

 public string InvalidReason(INakedObjectAdapter target, INakedObjectAdapter[] proposedArguments) {
     if (methodDelegate != null) {
         return (string)methodDelegate(target.GetDomainObject(), proposedArguments.Select(no => no.GetDomainObject()).ToArray());
     }
     //Fall back (e.g. if method has > 6 params) on reflection...
     Log.WarnFormat("Invoking validate method via reflection as no delegate {0}.{1}", target, method);
     return (string)InvokeUtils.Invoke(method, target, proposedArguments);
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:ActionValidationFacet.cs

示例7: InitProperty

 public void InitProperty(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter value) {
     try {
         property.SetValue(nakedObjectAdapter.GetDomainObject(), value.GetDomainObject(), null);
     }
     catch (TargetInvocationException e) {
         InvokeUtils.InvocationException("Exception executing " + property, e);
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:PropertyInitializationFacet.cs

示例8: Exceeds

 /// <summary>
 ///     Whether the provided argument exceeds the <see cref="SingleIntValueFacetAbstract.Value" /> maximum length}.
 /// </summary>
 public virtual bool Exceeds(INakedObjectAdapter nakedObjectAdapter) {
     var str = nakedObjectAdapter.GetDomainObject() as string;
     if (str == null) {
         return false;
     }
     int maxLength = Value;
     return maxLength != 0 && str.Length > maxLength;
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:11,代码来源:MaxLengthFacetAbstract.cs

示例9: SetProperty

 public override void SetProperty(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter value, ITransactionManager transactionManager, ISession session, ILifecycleManager lifecycleManager) {
     try {
         property.SetValue(nakedObjectAdapter.GetDomainObject(), value.GetDomainObject(), null);
     }
     catch (TargetInvocationException e) {
         InvokeUtils.InvocationException("Exception executing " + property, e);
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:PropertySetterFacetViaSetterMethod.cs

示例10: Init

        public override void Init(INakedObjectAdapter collection, INakedObjectAdapter[] initData) {
            Array newCollection = Array.CreateInstance(collection.GetDomainObject().GetType().GetElementType(), initData.Length);
            collection.ReplacePoco(newCollection);

            int i = 0;
            foreach (INakedObjectAdapter nakedObject in initData) {
                AsCollection(collection)[i++] = nakedObject.Object;
            }
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:9,代码来源:ArrayFacet.cs

示例11: GetProperty

 public object GetProperty(INakedObjectAdapter nakedObjectAdapter) {
     try {
         return propertyMethod.GetValue(nakedObjectAdapter.GetDomainObject(), null);
     }
     catch (TargetInvocationException e) {
         InvokeUtils.InvocationException("Exception executing " + propertyMethod, e);
         return null;
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:9,代码来源:PropertyAccessorFacet.cs

示例12: IsEditView

        public override bool IsEditView(INakedObjectAdapter nakedObjectAdapter) {
            var target = nakedObjectAdapter.GetDomainObject<IViewModelSwitchable>();

            if (target != null) {
                return target.IsEditView();
            }

            throw new NakedObjectSystemException(nakedObjectAdapter.Object == null ? "Null domain object" : "Wrong type of domain object: " + nakedObjectAdapter.Object.GetType().FullName);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:9,代码来源:ViewModelSwitchableFacetConvention.cs

示例13: IsEditable

        public bool IsEditable(ISession session, ILifecycleManager lifecycleManager, INakedObjectAdapter target, IIdentifier identifier) {
            object authorizer = GetAuthorizer(target, lifecycleManager);
            Type authType = authorizer.GetType();

            if ((typeof(INamespaceAuthorizer)).IsAssignableFrom(authType)) {
                var nameAuth = (INamespaceAuthorizer) authorizer;
                return nameAuth.IsEditable(session.Principal, target.Object, identifier.MemberName);
            }
            return isEditableDelegates[authType](authorizer, session.Principal, target.GetDomainObject(), identifier.MemberName);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:10,代码来源:AuthorizationManager.cs

示例14: Invoke

        public void Invoke(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter[] parameters, bool queryOnly, IIdentifier identifier, ISession session, ILifecycleManager lifecycleManager) {
            IAuditor auditor = GetAuditor(nakedObjectAdapter, lifecycleManager);

            IPrincipal byPrincipal = session.Principal;
            string memberName = identifier.MemberName;
            if (nakedObjectAdapter.Spec is IServiceSpec) {
                string serviceName = nakedObjectAdapter.Spec.GetTitle(nakedObjectAdapter);
                auditor.ActionInvoked(byPrincipal, memberName, serviceName, queryOnly, parameters.Select(no => no.GetDomainObject()).ToArray());
            }
            else {
                auditor.ActionInvoked(byPrincipal, memberName, nakedObjectAdapter.GetDomainObject(), queryOnly, parameters.Select(no => no.GetDomainObject()).ToArray());
            }
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:13,代码来源:AuditManager.cs

示例15: GetChoices

 public object[] GetChoices(INakedObjectAdapter inObjectAdapter, IDictionary<string, INakedObjectAdapter> parameterNameValues) {
     INakedObjectAdapter[] parms = FacetUtils.MatchParameters(parameterNames, parameterNameValues);
     try {
         object options = methodDelegate(inObjectAdapter.GetDomainObject(), parms.Select(p => p.GetDomainObject()).ToArray());
         var enumerable = options as IEnumerable;
         if (enumerable != null) {
             return enumerable.Cast<object>().ToArray();
         }
         throw new NakedObjectDomainException(Log.LogAndReturn($"Must return IEnumerable from choices method: {method.Name}"));
     }
     catch (ArgumentException ae) {
         throw new InvokeException(Log.LogAndReturn($"Choices exception: {method.Name} has mismatched (ie type of parameter does not match type of property) parameter types"), ae);
     }
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:14,代码来源:PropertyChoicesFacet.cs


注:本文中的INakedObjectAdapter.GetDomainObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。