本文整理汇总了C#中INakedObject类的典型用法代码示例。如果您正苦于以下问题:C# INakedObject类的具体用法?C# INakedObject怎么用?C# INakedObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INakedObject类属于命名空间,在下文中一共展示了INakedObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public virtual void Add(IOid oid, INakedObject adapter) {
lock (adapters) {
adapters[oid] = adapter;
}
// log after so that adapter is in map if required by ToString
Log.DebugFormat("Add {0} as {1}", oid, adapter);
}
示例2: Invoke
public static object Invoke(MethodInfo method, INakedObject nakedObject, INakedObject[] parameters) {
object[] parameterPocos = parameters == null ? new object[0] : new object[parameters.Length];
for (int i = 0; i < parameterPocos.Length; i++) {
parameterPocos[i] = parameters[i] == null ? null : parameters[i].Object;
}
return Invoke(method, nakedObject.Object, parameterPocos);
}
示例3: Page
private void Page(ICollectionFacet testArrayFacet, INakedObject collection, object first) {
INakedObject pagedCollection = testArrayFacet.Page(1, 1, collection, false);
var pagedCollectionFacet = new DotNetGenericIEnumerableFacet<object>(facetHolder, typeof (object), false);
Assert.IsTrue(pagedCollectionFacet.AsEnumerable(pagedCollection).Count() == 1);
Assert.AreSame(pagedCollectionFacet.AsEnumerable(pagedCollection).First().Object, first);
}
示例4: Persist
protected void Persist(INakedObject nakedObject, IPersistedObjectAdder persistor) {
if (nakedObject.ResolveState.IsAggregated() ||
(nakedObject.ResolveState.IsTransient() &&
nakedObject.Specification.Persistable != Persistable.TRANSIENT)) {
INakedObjectAssociation[] fields = nakedObject.Specification.Properties;
if (!nakedObject.Specification.IsEncodeable && fields.Length > 0) {
Log.Info("make persistent " + nakedObject);
nakedObject.Persisting();
if (!nakedObject.Specification.ContainsFacet(typeof (IComplexTypeFacet))) {
persistor.MadePersistent(nakedObject);
}
foreach (INakedObjectAssociation field in fields) {
if (!field.IsPersisted) {
continue;
}
if (field is IOneToManyAssociation) {
INakedObject collection = field.GetNakedObject(nakedObject);
if (collection == null) {
throw new NotPersistableException("Collection " + field.Name + " does not exist in " + nakedObject.Specification.FullName);
}
MakePersistent(collection, persistor);
}
else {
INakedObject fieldValue = field.GetNakedObject(nakedObject);
if (fieldValue == null) {
continue;
}
Persist(fieldValue, persistor);
}
}
persistor.AddPersistedObject(nakedObject);
}
}
}
示例5: Add
public virtual void Add(object obj, INakedObject adapter) {
lock (domainObjects) {
domainObjects[obj] = adapter;
}
// log at end so that if ToString needs adapters they're in maps.
Log.DebugFormat("Add instance of {0} as {1}", obj.GetType().FullName, adapter);
}
示例6: ClearPreviousTransients
private static void ClearPreviousTransients(this HttpSessionStateBase session, INakedObject nakedObject, ObjectFlag flag) {
if (nakedObject.Oid.HasPrevious) {
if (nakedObject.Oid.Previous.IsTransient) {
session.GetCache(flag).Remove(FrameworkHelper.GetObjectId(nakedObject.Oid.Previous));
}
}
}
示例7: HiddenReason
public override string HiddenReason(INakedObject nakedObject) {
if (nakedObject == null) {
return null;
}
var isHidden = (bool) InvokeUtils.Invoke(method, nakedObject);
return isHidden ? Resources.NakedObjects.Hidden : null;
}
示例8: MakePersistent
public void MakePersistent(INakedObject nakedObject, IPersistedObjectAdder persistor) {
if (nakedObject.Specification.IsCollection) {
MakeCollectionPersistent(nakedObject, persistor);
}
else {
MakeObjectPersistent(nakedObject, persistor);
}
}
示例9: GetNamespaceAuthorizerFor
private INamespaceAuditor GetNamespaceAuthorizerFor(INakedObject target) {
Assert.AssertNotNull(target);
string fullyQualifiedOfTarget = target.Specification.FullName;
return namespaceAuditors.
Where(x => fullyQualifiedOfTarget.StartsWith(x.NamespaceToAudit)).
OrderByDescending(x => x.NamespaceToAudit.Length).
FirstOrDefault();
}
示例10: AddDisposedObject
public virtual void AddDisposedObject(INakedObject nakedObject) {
lock (disposals) {
Log.DebugFormat("Mark as disposed {0}", nakedObject);
if (!disposals.Contains(nakedObject)) {
disposals.Add(nakedObject);
}
}
}
示例11: Exceeds
/// <summary>
/// Whether the provided argument exceeds the <see cref="SingleIntValueFacetAbstract.Value" /> maximum length}.
/// </summary>
public virtual bool Exceeds(INakedObject nakedObject) {
string str = UnwrapString(nakedObject);
if (str == null) {
return false;
}
int maxLength = Value;
return maxLength != 0 && str.Length > maxLength;
}
示例12: AddOrUpdateInCache
public static void AddOrUpdateInCache(this HttpSessionStateBase session, INakedObject nakedObject, string url, ObjectFlag flag = ObjectFlag.None) {
// only add transients if we are storing transients in the session
if ((!nakedObject.ResolveState.IsTransient() || MvcIdentityAdapterHashMap.StoringTransientsInSession) || nakedObject.Specification.IsCollection) {
session.ClearPreviousTransients(nakedObject, flag);
session.GetCache(flag).AddOrUpdateInCache(nakedObject, url, flag);
}
}
示例13: AddChangedObject
public virtual void AddChangedObject(INakedObject nakedObject) {
lock (changes) {
Log.DebugFormat("Mark as dirty {0}", nakedObject);
if (!changes.Contains(nakedObject)) {
changes.Add(nakedObject);
}
}
}
示例14: InvalidReason
public override string InvalidReason(INakedObject target, INakedObject proposedValue) {
if (proposedValue != null) {
return (string) InvokeUtils.Invoke(method, target, new[] {proposedValue});
}
else {
return null;
}
}
示例15: 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);
}
}