本文整理汇总了C#中INakedObject类的典型用法代码示例。如果您正苦于以下问题:C# INakedObject类的具体用法?C# INakedObject怎么用?C# INakedObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INakedObject类属于命名空间,在下文中一共展示了INakedObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:7,代码来源:IdentityAdapterHashMap.cs
示例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);
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例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);
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例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);
}
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:35,代码来源:DefaultPersistAlgorithm.cs
示例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);
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:7,代码来源:PocoAdapterHashMap.cs
示例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));
}
}
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例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;
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:7,代码来源:HideForContextFacetViaMethod.cs
示例8: MakePersistent
public void MakePersistent(INakedObject nakedObject, IPersistedObjectAdder persistor) {
if (nakedObject.Specification.IsCollection) {
MakeCollectionPersistent(nakedObject, persistor);
}
else {
MakeObjectPersistent(nakedObject, persistor);
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:EntityPersistAlgorithm.cs
示例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();
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:AuditManager.cs
示例10: AddDisposedObject
public virtual void AddDisposedObject(INakedObject nakedObject) {
lock (disposals) {
Log.DebugFormat("Mark as disposed {0}", nakedObject);
if (!disposals.Contains(nakedObject)) {
disposals.Add(nakedObject);
}
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:SimpleUpdateNotifier.cs
示例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;
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:11,代码来源:MaxLengthFacetAbstract.cs
示例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);
}
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例13: AddChangedObject
public virtual void AddChangedObject(INakedObject nakedObject) {
lock (changes) {
Log.DebugFormat("Mark as dirty {0}", nakedObject);
if (!changes.Contains(nakedObject)) {
changes.Add(nakedObject);
}
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:SimpleUpdateNotifier.cs
示例14: InvalidReason
public override string InvalidReason(INakedObject target, INakedObject proposedValue) {
if (proposedValue != null) {
return (string) InvokeUtils.Invoke(method, target, new[] {proposedValue});
}
else {
return null;
}
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例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);
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:PropertySetterFacetViaSetterMethod.cs
示例16: 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);
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:9,代码来源:ViewModelSwitchableFacetConvention.cs
示例17: PageInternal
private IEnumerable PageInternal(int page, int size, INakedObject collection) {
int firstIndex = (page - 1)*size;
for (int index = firstIndex; index < firstIndex + size; index++) {
if (index >= AsEnumerable(collection).Count()) {
yield break;
}
yield return AsCollection(collection)[index];
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:9,代码来源:DotNetCollectionFacet.cs
示例18: 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;
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:9,代码来源:PropertyAccessorFacetViaAccessor.cs
示例19: Init
public override void Init(INakedObject collection, INakedObject[] initData) {
IList wrappedCollection = AsCollection(collection);
List<object> toAdd = initData.Select(no => no.Object).Where(obj => !wrappedCollection.Contains(obj)).ToList();
toAdd.ForEach(obj => wrappedCollection.Add(obj));
List<object> toRemove = wrappedCollection.Cast<object>().Where(o => !initData.Select(x => x.Object).Contains(o)).ToList();
toRemove.ForEach(wrappedCollection.Remove);
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:9,代码来源:DotNetCollectionFacet.cs
示例20: 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;
}
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:9,代码来源:DotNetArrayFacet.cs
注:本文中的INakedObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论