public ActionInvocationFacetViaMethod(MethodInfo method, INakedObjectSpecification onType, INakedObjectSpecification returnType, IFacetHolder holder) : base(holder) { actionMethod = method; paramCount = method.GetParameters().Length; this.onType = onType; this.returnType = returnType; }
internal ProgrammableNakedObject(object poco, INakedObjectSpecification specification, IOid oid) { this.poco = poco; this.specification = specification; this.oid = oid; resolveState = new ResolveStateMachine(this); }
protected NakedObjectAssociationAbstract(string fieldId, INakedObjectSpecification specification, IFacetHolder facetHolder) : base(fieldId, facetHolder) { if (specification == null) { throw new ArgumentException(string.Format(Resources.NakedObjects.MissingFieldType, fieldId)); } this.specification = specification; }
public static INakedObjectAction GetOverloadedAction(string actionName, INakedObjectSpecification spec) { INakedObjectAction action = null; INakedObjectAction[] actions = spec.GetActionLeafNodes(); Tuple<INakedObjectAction, string>[] overloadedActions = GetOverloadedActionsAndUIds(actions); if (overloadedActions.Any()) { Tuple<INakedObjectAction, string> matchingAction = overloadedActions.SingleOrDefault(oa => oa.Item1.Id + oa.Item2 == actionName); if (matchingAction != null) { action = matchingAction.Item1; } } return action; }
public IQueryable <ObjectData> GetInstances(INakedObjectSpecification specification) { return(null); }
public static void ClearDestroyedObjectsOfType(this HttpSessionStateBase session, INakedObjectSpecification spec, ObjectFlag flag = ObjectFlag.None) { Dictionary<string, CacheMemento> cache = session.GetCache(flag); List<string> toRemove = cache.Where(cm => cm.Value.Spec.IsOfType(spec)).Select(kvp => new { kvp.Key, no = SafeGetNakedObjectFromId(kvp.Key) }).Where(ao => ao.no.ResolveState.IsDestroyed()).Select(ao => ao.Key).ToList(); toRemove.ForEach(k => cache.Remove(k)); }
private static IEnumerable<INakedObject> GetAndTidyCachedNakedObjectsOfType(this HttpSessionStateBase session, INakedObjectSpecification spec, ObjectFlag flag) { session.ClearDestroyedObjectsOfType(spec, flag); return session.GetCache(flag).Where(cm => cm.Value.Spec.IsOfType(spec)).OrderBy(kvp => kvp.Value.Added).Select(kvp => FrameworkHelper.GetNakedObjectFromId(kvp.Key)); }
public CollectionData(INakedObjectSpecification type, IOid oid, IVersion version) : base(type, oid, version) {}
public static INakedObject RecreateInstance(IOid oid, INakedObjectSpecification specification) { return NakedObjectsContext.ObjectPersistor.RecreateInstance(oid, specification); }
public virtual void Cache(string className, INakedObjectSpecification spec) { lock (specs) { specs[className] = spec; } }
public DotNetNakedObjectActionParamPeer(INakedObjectSpecification specification) { this.specification = specification; }
public static Tuple<INakedObjectAction, string>[] GetActionsandUidFromSpec(INakedObjectSpecification spec) { INakedObjectAction[] actions = spec.GetActionLeafNodes(); return actions.Select(action => new Tuple<INakedObjectAction, string>(action, GetOverloadedUId(action, spec))).ToArray(); }
protected Data(INakedObjectSpecification type, IOid oid, IVersion version) { this.type = type.FullName; this.oid = oid; this.version = version; }
private object GetCompletionData(INakedObject nakedObject, INakedObjectSpecification spec) { string label = nakedObject.TitleString(); string value = nakedObject.TitleString(); string link = spec.IsParseable ? label : FrameworkHelper.GetObjectId(nakedObject); string src = GetIconSrc(nakedObject); string alt = GetIconAlt(nakedObject); return new {label, value, link, src, alt}; }
private static INakedObject GetValue(string[] values, INakedObjectSpecification spec) { if (!values.Any()) { return null; } if (spec.IsParseable) { return spec.GetFacet<IParseableFacet>().ParseTextEntry(values.First()); } if (spec.IsCollection) { return FrameworkHelper.GetTypedCollection(spec, values); } return FrameworkHelper.GetNakedObjectFromId(values.First()); }
public ViewModelOid(INakedObjectSpecification specification) { IsTransient = false; TypeName = TypeNameUtils.EncodeTypeName(specification.FullName); Keys = new[] {System.Guid.NewGuid().ToString()}; CacheState(); }
public CollectionData(INakedObjectSpecification type, IOid oid, IVersion version) : base(type, oid, version) { }
public void AddSpecification(INakedObjectSpecification specification) { specs[specification.FullName] = specification; }
public override void AddSubclass(INakedObjectSpecification specification) {}
public void SetupSubclasses(INakedObjectSpecification[] subclasses) { this.subclasses = subclasses; }
public static string GetOverloadedUId(INakedObjectAction action, INakedObjectSpecification spec) { INakedObjectAction[] actions = spec.GetActionLeafNodes(); Tuple<INakedObjectAction, string>[] overloadedActions = GetOverloadedActionsAndUIds(actions); return overloadedActions.Where(oa => oa.Item1 == action).Select(oa => oa.Item2).SingleOrDefault(); }
public override bool IsOfType(INakedObjectSpecification specification) { return specification == this; }
public static Tuple<INakedObjectAction, string> GetActionandUidFromSpec(INakedObjectSpecification spec, string actionName, string typeName) { INakedObjectAction[] actions = spec.GetActionLeafNodes(); INakedObjectAction action = actions.SingleOrDefault(p => p.Id == actionName) ?? GetOverloadedAction(actionName, spec); if (action == null) { throw new TypeActionResourceNotFoundNOSException(actionName, typeName); } string uid = GetOverloadedUId(action, spec); return new Tuple<INakedObjectAction, string>(action, uid); }
public void SetupSpecification(INakedObjectSpecification spec) { specification = spec; }
public NotContributedActionFacetImpl(IFacetHolder holder, INakedObjectSpecification[] notContributedToTypes) : base(holder, notContributedToTypes) {}
public static INakedObject CreateTransientInstance(INakedObjectSpecification specification) { return NakedObjectsContext.ObjectPersistor.CreateInstance(specification); }
private static IQueryable<IOid> LoadInstances(INakedObjectSpecification spec) { List<IOid> instances = LoadInstances(spec.FullName).ToList(); foreach (INakedObjectSpecification subSpec in spec.Subclasses) { instances.AddRange(LoadInstances(subSpec).ToList()); } return instances.AsQueryable(); }
public IQueryable<ObjectData> GetInstances(INakedObjectSpecification specification) { return null; }
public virtual IQueryable<ObjectData> GetInstances(INakedObjectSpecification specification) { EnsureTypesLoaded(); return from instance in LoadInstances(specification) select (ObjectData) LoadData(instance); }
public static IEnumerable<object> CachedObjectsOfType(this HttpSessionStateBase session, INakedObjectSpecification spec, ObjectFlag flag = ObjectFlag.None) { return session.GetAndTidyCachedNakedObjectsOfType(spec, flag).Select(no => no.Object); }
public void LoadNode(XElement Node, ref CollectionData collection, ref ObjectData objectData, ref string fieldName) { string tag = Node.Name.LocalName; if (objectData != null) { if (tag.Equals("value")) { fieldName = Node.Attribute("field").Value; objectData.SetField(fieldName, Node.Value); } else if (tag.Equals("inline")) { CollectionData sinkCollection = null; ObjectData inlineObjectData = null; string sinkName = ""; fieldName = Node.Attribute("field").Value; LoadNode(Node.Element("naked-object"), ref sinkCollection, ref inlineObjectData, ref sinkName); objectData.SetField(fieldName, inlineObjectData); } else if (tag.Equals("association")) { fieldName = Node.Attribute("field").Value; long id = Convert.ToInt64(Node.Attribute("ref").Value, 16); objectData.SetField(fieldName, SerialOid.CreatePersistent(id, Node.Attribute("Type").Value)); } else if (tag.Equals("element")) { long id = Convert.ToInt64(Node.Attribute("ref").Value, 16); objectData.AddElement(fieldName, SerialOid.CreatePersistent(id, Node.Attribute("Type").Value)); } else if (tag.Equals("multiple-association")) { fieldName = Node.Attribute("field").Value; objectData.InitCollection(fieldName); } } else if (collection != null) { if (tag.Equals("element")) { long id = Convert.ToInt64(Node.Attribute("ref").Value, 16); collection.AddElement(SerialOid.CreatePersistent(id, Node.Attribute("Type").Value)); } } else { if (tag.Equals("naked-object")) { string type = Node.Attribute("Type").Value; string user = Node.Attribute("user").Value; IVersion version = GetVersion(Node, user); IOid oid = GetOid(Node, type); INakedObjectSpecification spec = NakedObjectsContext.Reflector.LoadSpecification(type); objectData = new ObjectData(spec, oid, version); } else if (tag.Equals("collection")) { string type = Node.Attribute("Type").Value; long version = Convert.ToInt64(Node.Attribute("ver").Value, 16); string user = Node.Attribute("user").Value; long id = Convert.ToInt64(Node.Attribute("id").Value, 16); INakedObjectSpecification spec = NakedObjectsContext.Reflector.LoadSpecification(type); IOid oid = SerialOid.CreatePersistent(id, type); collection = new CollectionData(spec, oid, new FileVersion(user, version)); } else { throw new XmlException("Invalid data"); } } }
public ProgrammableNakedObject(object poco, INakedObjectSpecification specification) { this.poco = poco; this.specification = specification; }
public INakedObject CreateCollectionAdapter(object collection, INakedObjectSpecification elementSpecification) { return null; }