Skip to content

Commit

Permalink
Reverted change from #1483 to AsyncDaemon as it's too big effort to f…
Browse files Browse the repository at this point in the history
…ix keeping in mind that this will be soon rewritten
  • Loading branch information
oskardudycz committed Jun 10, 2020
1 parent 692d148 commit 93b9c63
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public async Task default_id_event_should_not_create_new_document()
documentCount.ShouldBe(0);
}

[Fact]
[Fact(Skip = "Failing test for #1302")]
public async Task projectview_withdeleteevent_should_be_respected_during_projection_rebuild()
{
StoreOptions(_ =>
Expand Down
2 changes: 1 addition & 1 deletion src/Marten/DocumentStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public IDaemon BuildProjectionDaemon(Type[] viewTypes = null, IDaemonLogger logg

if (projections == null)
{
projections = viewTypes?.SelectMany(x => Events.AllProjectionsFor(x)).Where(x => x != null).ToArray() ?? Events.AsyncProjections.ToArray();
projections = viewTypes?.Select(x => Events.ProjectionFor(x)).Where(x => x != null).ToArray() ?? Events.AsyncProjections.ToArray();
}

return new Daemon(this, Tenancy.Default, settings ?? new DaemonSettings(), logger ?? new NulloDaemonLogger(), projections);
Expand Down
6 changes: 0 additions & 6 deletions src/Marten/Events/EventGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,11 @@ public string AggregateAliasFor(Type aggregateType)
return aggregator.Alias;
}

//TODO: This should be merged in V4 with AllForView method to return IEnumerable
public IProjection ProjectionFor(Type viewType)
{
return AsyncProjections.ForView(viewType) ?? InlineProjections.ForView(viewType);
}

public IEnumerable<IProjection> AllProjectionsFor(Type viewType)
{
return AsyncProjections.AllForView(viewType).Union(InlineProjections.AllForView(viewType));
}

public ViewProjection<TView, TId> ProjectView<TView, TId>() where TView : class
{
var projection = new ViewProjection<TView, TId>();
Expand Down
7 changes: 0 additions & 7 deletions src/Marten/Events/Projections/ProjectionCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,9 @@ public void Add<T>(Func<T> projectionFactory) where T : IProjection
_projections.Add(lazyLoadedProjection);
}


//TODO: This should be merged in V4 with AllForView method to return IEnumerable
public IProjection ForView(Type viewType)
{
return _projections.FirstOrDefault(x => x.ProjectedType() == viewType);
}

public IEnumerable<IProjection> AllForView(Type viewType)
{
return _projections.Where(x => x.ProjectedType() == viewType).ToList();
}
}
}

0 comments on commit 93b9c63

Please sign in to comment.