Skip to content

Commit

Permalink
DataContext API changes.
Browse files Browse the repository at this point in the history
Don't force arrays onto users.
  • Loading branch information
zapov committed Oct 15, 2014
1 parent a83336d commit 006fa0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Code/Domain/Revenj.DomainPatterns.Interface/DataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface IDataContext
/// </summary>
/// <typeparam name="T">aggregate type</typeparam>
/// <param name="aggregates">new aggregates</param>
void Create<T>(T[] aggregates) where T : IAggregateRoot;
void Create<T>(IEnumerable<T> aggregates) where T : IAggregateRoot;
/// <summary>
/// Update existing aggregate roots. Provide pair of old and new.
/// Old value is optional. Change track value will be used on null values.
Expand All @@ -41,20 +41,20 @@ public interface IDataContext
/// </summary>
/// <typeparam name="T">aggregate type</typeparam>
/// <param name="pairs">aggregate pairs</param>
void Update<T>(KeyValuePair<T, T>[] pairs) where T : IAggregateRoot;
void Update<T>(IEnumerable<KeyValuePair<T, T>> pairs) where T : IAggregateRoot;
/// <summary>
/// Delete existing aggregate roots.
/// Data will be sent immediately to the backing store.
/// </summary>
/// <typeparam name="T">aggregate type</typeparam>
/// <param name="aggregates">remove provided aggregate roots</param>
void Delete<T>(T[] aggregates) where T : IAggregateRoot;
void Delete<T>(IEnumerable<T> aggregates) where T : IAggregateRoot;
/// <summary>
/// Raise domain events
/// </summary>
/// <typeparam name="T">event type</typeparam>
/// <param name="events">domain events</param>
void Submit<T>(T[] events) where T : IDomainEvent;
void Submit<T>(IEnumerable<T> events) where T : IDomainEvent;
/// <summary>
/// Populate report
/// </summary>
Expand All @@ -74,7 +74,7 @@ public interface IDataContext
/// <typeparam name="T">aggregate type</typeparam>
/// <param name="uris">identifiers</param>
/// <returns>found history</returns>
IHistory<T>[] History<T>(string[] uris) where T : IObjectHistory;
IHistory<T>[] History<T>(IEnumerable<string> uris) where T : IObjectHistory;
/// <summary>
/// OLAP cube builder. Data analysis using dimensions and facts
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

[assembly: CLSCompliant(true)]
10 changes: 5 additions & 5 deletions Code/Domain/Revenj.DomainPatterns/DataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ private IPersistableRepository<T> GetRepository<T>() where T : IAggregateRoot
return (IPersistableRepository<T>)repository;
}

public void Create<T>(T[] aggregates) where T : IAggregateRoot
public void Create<T>(IEnumerable<T> aggregates) where T : IAggregateRoot
{
var repository = GetRepository<T>();
repository.Persist(aggregates, null, null);
}

public void Update<T>(KeyValuePair<T, T>[] pairs) where T : IAggregateRoot
public void Update<T>(IEnumerable<KeyValuePair<T, T>> pairs) where T : IAggregateRoot
{
var repository = GetRepository<T>();
repository.Persist(null, pairs, null);
}

public void Delete<T>(T[] aggregates) where T : IAggregateRoot
public void Delete<T>(IEnumerable<T> aggregates) where T : IAggregateRoot
{
var repository = GetRepository<T>();
repository.Persist(null, null, aggregates);
Expand All @@ -98,7 +98,7 @@ private IDomainEventStore<T> GetStore<T>() where T : IDomainEvent
return (IDomainEventStore<T>)store;
}

public void Submit<T>(T[] events) where T : IDomainEvent
public void Submit<T>(IEnumerable<T> events) where T : IDomainEvent
{
var store = GetStore<T>();
store.Submit(events);
Expand Down Expand Up @@ -130,7 +130,7 @@ private IRepository<IHistory<T>> GetHistory<T>() where T : IObjectHistory
return (IRepository<IHistory<T>>)repository;
}

public IHistory<T>[] History<T>(string[] uris) where T : IObjectHistory
public IHistory<T>[] History<T>(IEnumerable<string> uris) where T : IObjectHistory
{
var repository = GetHistory<T>();
return repository.Find(uris);
Expand Down

0 comments on commit 006fa0c

Please sign in to comment.