private ObjectState(ObjectState objectStateToClone) { id = objectStateToClone.id; typeId = objectStateToClone.typeId; relations = objectStateToClone.relations.Clone(); attributes = new Dictionary <string, object>(objectStateToClone.attributes); }
public static void Create <TCommand, TTarget>(this ICommandExecutionContext context, ITypedCommandHandler <TCommand, TTarget> handler) where TCommand : TypedCommand <TTarget> { var typeAttribute = AttributeBasedObjectTypeMapping.GetTypeAttibute(typeof(TTarget)); context.Create(ObjectTypeId.Parse(typeAttribute.TypeIdValue)); }
public ObjectState(ObjectId id, ObjectTypeId typeId) { this.id = id; this.typeId = typeId; relations = new ObjectRelationCollection(); attributes = new Dictionary <string, object>(); }
public ObjectTypeDescriptor(Type runtimeType, ObjectTypeId objectTypeId, IEnumerable <AttributeDescriptor> attributes, IEnumerable <RelationDescriptor> relations) { this.attributes = attributes.ToList(); this.relations = relations.ToList(); this.objectTypeId = objectTypeId; this.runtimeType = runtimeType; }
public void ExecuteCommands(ObjectTypeId objectTypeId, ICommandExecutor commandExecutor, CompositeCommandExecutionContext compositeContext) { foreach (var command in commands) { var context = compositeContext.GetFor(command.TargetObjectId); commandExecutor.Execute(command, context); } }
public static ObjectTypeDescriptorRepository RegisterUsingReflection(this ObjectTypeDescriptorRepository repository, Type typeToRegister) { var typeAttibute = GetTypeAttibute(typeToRegister); var objectTypeId = new ObjectTypeId(new Guid(typeAttibute.TypeIdValue)); var typeDescritor = new ObjectTypeDescriptor(typeToRegister, objectTypeId, DiscoverAttributes(typeToRegister), DiscoverRelations(typeToRegister)); repository.RegisterTypeDescriptor(typeDescritor); return(repository); }
protected override IEnumerable <ObjectState> RetrieveData(ObjectTypeId objectTypeId) { var data = base.RetrieveData(objectTypeId); foreach (var loadedState in data) { loadedStates[loadedState.Id] = loadedState; } return(data); }
protected virtual IEnumerable <ObjectState> RetrieveData(ObjectTypeId objectTypeId) { return(dataRetrievalStrategy.Enumerate().Where(x => x.TypeId == objectTypeId)); }
public ObjectTypeDescriptor GetByTypeId(ObjectTypeId objectTypeId) { ObjectTypeDescriptor existing; return(map.TryGetValue(objectTypeId, out existing) ? existing : null); }
public void Create(ObjectTypeId objectTypeId) { instance = new ObjectState(targetObjectId, objectTypeId); }