Commit fd8871e
Changed files (130)
product
client
database
db4o
transactions
presentation.windows
presenters
service
service.infrastructure
debugging
eventing
logging
security
transactions
updating
commons
infrastructure
threading
infrastructure.thirdparty
presentation.windows.common
presentation.windows.server
product/client/database/db4o/ConfigureDatabaseStep.cs
@@ -1,18 +0,0 @@
-using Db4objects.Db4o.Config;
-using gorilla.commons.utility;
-
-namespace momoney.database.db4o
-{
- public interface IConfigureDatabaseStep : Configuration<IConfiguration> {}
-
- public class ConfigureDatabaseStep : IConfigureDatabaseStep
- {
- public void configure(IConfiguration item)
- {
- item.LockDatabaseFile(false);
- //item.UpdateDepth(10);
- //item.WeakReferences(true);
- //item.AutomaticShutDown(true);
- }
- }
-}
\ No newline at end of file
product/client/database/db4o/ConfigureObjectContainerStep.cs
@@ -1,19 +0,0 @@
-using Db4objects.Db4o;
-using Db4objects.Db4o.Events;
-using gorilla.commons.utility;
-
-namespace momoney.database.db4o
-{
- public interface IConfigureObjectContainerStep : Configuration<IObjectContainer> {}
-
- public class ConfigureObjectContainerStep : IConfigureObjectContainerStep
- {
- public void configure(IObjectContainer item)
- {
- var registry = EventRegistryFactory.ForObjectContainer(item);
- //registry.ClassRegistered += (sender, args) => this.log().debug("class registered: {0}", args.ClassMetadata());
- //registry.Instantiated += (sender, args) => this.log().debug("class instantiated: {0}", args.Object.GetType().Name);
- //registry.Committed += (sender, args) => this.log().debug("added: {0}, updated: {1}, deleted: {2}", args.Added, args.Updated, args.Deleted);
- }
- }
-}
\ No newline at end of file
product/client/database/db4o/ConnectionFactory.cs
@@ -1,34 +0,0 @@
-using Db4objects.Db4o;
-using Db4objects.Db4o.Config;
-using Gorilla.Commons.Infrastructure.FileSystem;
-using gorilla.commons.utility;
-using momoney.database.transactions;
-
-namespace momoney.database.db4o
-{
- public class ConnectionFactory : IConnectionFactory
- {
- readonly IConfigureDatabaseStep setup;
- readonly IConfigureObjectContainerStep setup_container;
-
- public ConnectionFactory(IConfigureDatabaseStep setup, IConfigureObjectContainerStep setup_container)
- {
- this.setup = setup;
- this.setup_container = setup_container;
- }
-
- public DatabaseConnection open_connection_to(File the_path_to_the_database_file)
- {
- var configuration = Db4oFactory.NewConfiguration();
- setup.configure(configuration);
- return new ObjectDatabaseConnection(get_container(the_path_to_the_database_file, configuration));
- }
-
- IObjectContainer get_container(File the_path_to_the_database_file, IConfiguration configuration)
- {
- return Db4oFactory
- .OpenFile(configuration, the_path_to_the_database_file.path)
- .and_configure_with(setup_container);
- }
- }
-}
\ No newline at end of file
product/client/database/db4o/ObjectDatabaseConnection.cs
@@ -1,48 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Db4objects.Db4o;
-using momoney.database.transactions;
-
-namespace momoney.database.db4o
-{
- public class ObjectDatabaseConnection : DatabaseConnection
- {
- readonly IObjectContainer container;
-
- public ObjectDatabaseConnection(IObjectContainer container)
- {
- this.container = container;
- }
-
- public void Dispose()
- {
- container.Close();
- container.Dispose();
- }
-
- public IEnumerable<T> query<T>()
- {
- return container.Query<T>();
- }
-
- public IEnumerable<T> query<T>(Predicate<T> predicate)
- {
- return container.Query(predicate);
- }
-
- public void delete<T>(T entity)
- {
- container.Delete(entity);
- }
-
- public void commit()
- {
- container.Commit();
- }
-
- public void store<T>(T entity)
- {
- container.Store(entity);
- }
- }
-}
\ No newline at end of file
product/client/database/repositories/AccountHolderRepository.cs
@@ -1,25 +0,0 @@
-//using MoMoney.Domain.accounting;
-//using MoMoney.Domain.repositories;
-
-namespace momoney.database.repositories
-{
- //public class AccountHolderRepository : IAccountHolderRepository
- //{
- // readonly ISession session;
-
- // public AccountHolderRepository(ISession session)
- // {
- // this.session = session;
- // }
-
- // public IEnumerable<AccountHolder> all()
- // {
- // return session.all<AccountHolder>();
- // }
-
- // public void save(AccountHolder account_holder)
- // {
- // session.save(account_holder);
- // }
- //}
-}
\ No newline at end of file
product/client/database/repositories/BillRepository.cs
@@ -1,20 +0,0 @@
-//using MoMoney.Domain.Accounting;
-//using MoMoney.Domain.repositories;
-
-namespace momoney.database.repositories
-{
- //public class BillRepository : IBillRepository
- //{
- // readonly ISession session;
-
- // public BillRepository(ISession session)
- // {
- // this.session = session;
- // }
-
- // public IEnumerable<Bill> all()
- // {
- // return session.all<Bill>();
- // }
- //}
-}
\ No newline at end of file
product/client/database/repositories/CompanyRepository.cs
@@ -1,35 +0,0 @@
-//using MoMoney.Domain.Accounting;
-//using MoMoney.Domain.repositories;
-
-namespace momoney.database.repositories
-{
- //public class CompanyRepository : ICompanyRepository
- //{
- // readonly ISession session;
-
- // public CompanyRepository(ISession session)
- // {
- // this.session = session;
- // }
-
- // public IEnumerable<Company> all()
- // {
- // return session.all<Company>();
- // }
-
- // public Company find_company_named(string name)
- // {
- // return all().SingleOrDefault(x => x.name.is_equal_to_ignoring_case(name));
- // }
-
- // public Company find_company_by(Guid id)
- // {
- // return all().SingleOrDefault(x => x.id.Equals(id));
- // }
-
- // public void save(Company company)
- // {
- // session.save(company);
- // }
- //}
-}
\ No newline at end of file
product/client/database/repositories/IncomeRepository.cs
@@ -1,20 +0,0 @@
-//using MoMoney.Domain.Accounting;
-//using MoMoney.Domain.repositories;
-
-namespace momoney.database.repositories
-{
- //public class IncomeRepository : IIncomeRepository
- //{
- // readonly ISession session;
-
- // public IncomeRepository(ISession session)
- // {
- // this.session = session;
- // }
-
- // public IEnumerable<Income> all()
- // {
- // return session.all<Income>();
- // }
- //}
-}
\ No newline at end of file
product/client/database/transactions/ChangeTracker.cs
@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public class ChangeTracker<T> : IChangeTracker<T> where T : Identifiable<Guid>
- {
- readonly ITrackerEntryMapper<T> mapper;
- readonly DatabaseCommandRegistry registry;
- readonly IList<ITrackerEntry<T>> items;
- readonly IList<T> to_be_deleted;
-
- public ChangeTracker(ITrackerEntryMapper<T> mapper, DatabaseCommandRegistry registry)
- {
- this.mapper = mapper;
- this.registry = registry;
- items = new List<ITrackerEntry<T>>();
- to_be_deleted = new List<T>();
- }
-
- public void register(T entity)
- {
- items.Add(mapper.map_from(entity));
- }
-
- public void delete(T entity)
- {
- to_be_deleted.Add(entity);
- }
-
- public void commit_to(IDatabase database)
- {
- items.each(x => commit(x, database));
- to_be_deleted.each(x => database.apply(registry.prepare_for_deletion(x)));
- }
-
- public bool is_dirty()
- {
- return items.Count(x => x.has_changes()) > 0 || to_be_deleted.Count > 0;
- }
-
- public void Dispose()
- {
- items.Clear();
- }
-
- void commit(ITrackerEntry<T> entry, IDatabase database)
- {
- if (entry.has_changes()) database.apply(registry.prepare_for_flushing(entry.current));
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/ChangeTrackerFactory.cs
@@ -1,23 +0,0 @@
-using System;
-using Gorilla.Commons.Infrastructure.Container;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public class ChangeTrackerFactory : IChangeTrackerFactory
- {
- readonly DatabaseCommandRegistry statement_registry;
- readonly DependencyRegistry registry;
-
- public ChangeTrackerFactory(DatabaseCommandRegistry statement_registry, DependencyRegistry registry)
- {
- this.statement_registry = statement_registry;
- this.registry = registry;
- }
-
- public IChangeTracker<T> create_for<T>() where T : Identifiable<Guid>
- {
- return new ChangeTracker<T>(registry.get_a<ITrackerEntryMapper<T>>(), statement_registry);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/DatabaseCommand.cs
@@ -1,6 +0,0 @@
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface DatabaseCommand : Command<DatabaseConnection> {}
-}
\ No newline at end of file
product/client/database/transactions/DatabaseCommandRegistry.cs
@@ -1,11 +0,0 @@
-using System;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface DatabaseCommandRegistry
- {
- DatabaseCommand prepare_for_deletion<T>(T entity) where T : Identifiable<Guid>;
- DatabaseCommand prepare_for_flushing<T>(T entity) where T : Identifiable<Guid>;
- }
-}
\ No newline at end of file
product/client/database/transactions/DatabaseConnection.cs
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace momoney.database.transactions
-{
- public interface DatabaseConnection : IDisposable
- {
- IEnumerable<T> query<T>();
- IEnumerable<T> query<T>(Predicate<T> predicate);
- void delete<T>(T entity);
- void commit();
- void store<T>(T entity);
- }
-}
\ No newline at end of file
product/client/database/transactions/DeleteFromDatabase.cs
@@ -1,17 +0,0 @@
-namespace momoney.database.transactions
-{
- public class DeleteFromDatabase<T> : DatabaseCommand
- {
- readonly T entity;
-
- public DeleteFromDatabase(T entity)
- {
- this.entity = entity;
- }
-
- public void run_against(DatabaseConnection connection)
- {
- connection.delete(entity);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/IChangeTracker.cs
@@ -1,17 +0,0 @@
-using System;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface IChangeTracker : IDisposable
- {
- bool is_dirty();
- void commit_to(IDatabase database);
- }
-
- public interface IChangeTracker<T> : IChangeTracker where T : Identifiable<Guid>
- {
- void register(T value);
- void delete(T entity);
- }
-}
\ No newline at end of file
product/client/database/transactions/IChangeTrackerFactory.cs
@@ -1,10 +0,0 @@
-using System;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface IChangeTrackerFactory
- {
- IChangeTracker<T> create_for<T>() where T : Identifiable<Guid>;
- }
-}
\ No newline at end of file
product/client/database/transactions/IDatabase.cs
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface IDatabase
- {
- IEnumerable<T> fetch_all<T>() where T : Identifiable<Guid>;
- void apply(DatabaseCommand command);
- }
-}
\ No newline at end of file
product/client/database/transactions/IdentityMapProxy.cs
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public class IdentityMapProxy<Key, Value> : IIdentityMap<Key, Value> where Value : Identifiable<Guid>
- {
- readonly IIdentityMap<Key, Value> real_map;
- readonly IChangeTracker<Value> change_tracker;
-
- public IdentityMapProxy(IChangeTracker<Value> change_tracker, IIdentityMap<Key, Value> real_map)
- {
- this.change_tracker = change_tracker;
- this.real_map = real_map;
- }
-
- public IEnumerable<Value> all()
- {
- return real_map.all();
- }
-
- public void add(Key key, Value value)
- {
- change_tracker.register(value);
- real_map.add(key, value);
- }
-
- public void update_the_item_for(Key key, Value new_value)
- {
- real_map.update_the_item_for(key, new_value);
- }
-
- public bool contains_an_item_for(Key key)
- {
- return real_map.contains_an_item_for(key);
- }
-
- public Value item_that_belongs_to(Key key)
- {
- return real_map.item_that_belongs_to(key);
- }
-
- public void evict(Key key)
- {
- change_tracker.delete(real_map.item_that_belongs_to(key));
- real_map.evict(key);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/IIdentityMap.cs
@@ -1,59 +0,0 @@
-using System.Collections.Generic;
-
-namespace momoney.database.transactions
-{
- public interface IIdentityMap<TKey, TValue>
- {
- IEnumerable<TValue> all();
- void add(TKey key, TValue value);
- void update_the_item_for(TKey key, TValue new_value);
- bool contains_an_item_for(TKey key);
- TValue item_that_belongs_to(TKey key);
- void evict(TKey key);
- }
-
- public class IdentityMap<TKey, TValue> : IIdentityMap<TKey, TValue>
- {
- readonly IDictionary<TKey, TValue> items_in_map;
-
- public IdentityMap() : this(new Dictionary<TKey, TValue>())
- {
- }
-
- public IdentityMap(IDictionary<TKey, TValue> items_in_map)
- {
- this.items_in_map = items_in_map;
- }
-
- public IEnumerable<TValue> all()
- {
- return items_in_map.Values;
- }
-
- public void add(TKey key, TValue value)
- {
- items_in_map.Add(key, value);
- }
-
- public void update_the_item_for(TKey key, TValue new_value)
- {
- if (contains_an_item_for(key)) items_in_map[key] = new_value;
- else add(key, new_value);
- }
-
- public bool contains_an_item_for(TKey key)
- {
- return items_in_map.ContainsKey(key);
- }
-
- public TValue item_that_belongs_to(TKey key)
- {
- return contains_an_item_for(key) ? items_in_map[key] : default(TValue);
- }
-
- public void evict(TKey key)
- {
- if (contains_an_item_for(key)) items_in_map.Remove(key);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/ObjectDatabaseCommandRegistry.cs
@@ -1,18 +0,0 @@
-using System;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public class ObjectDatabaseCommandRegistry : DatabaseCommandRegistry
- {
- public DatabaseCommand prepare_for_deletion<T>(T entity) where T : Identifiable<Guid>
- {
- return new DeleteFromDatabase<T>(entity);
- }
-
- public DatabaseCommand prepare_for_flushing<T>(T entity) where T : Identifiable<Guid>
- {
- return new SaveOrUpdateFromDatabase<T>(entity);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/SaveOrUpdateFromDatabase.cs
@@ -1,20 +0,0 @@
-using System;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public class SaveOrUpdateFromDatabase<T> : DatabaseCommand where T : Identifiable<Guid>
- {
- readonly T entity;
-
- public SaveOrUpdateFromDatabase(T entity)
- {
- this.entity = entity;
- }
-
- public void run_against(DatabaseConnection connection)
- {
- connection.store(entity);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/Session.cs
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Gorilla.Commons.Infrastructure.Logging;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface ISession : IDisposable
- {
- T find<T>(Guid guid) where T : Identifiable<Guid>;
- IEnumerable<T> all<T>() where T : Identifiable<Guid>;
- void save<T>(T entity) where T : Identifiable<Guid>;
- void delete<T>(T entity) where T : Identifiable<Guid>;
- void flush();
- bool is_dirty();
- }
-
- public class Session : ISession
- {
- ITransaction transaction;
- readonly IDatabase database;
- readonly IDictionary<Type, object> identity_maps;
- long id;
-
- public Session(ITransaction transaction, IDatabase database)
- {
- this.database = database;
- this.transaction = transaction;
- identity_maps = new Dictionary<Type, object>();
- id = DateTime.Now.Ticks;
- }
-
- public T find<T>(Guid id) where T : Identifiable<Guid>
- {
- if (get_identity_map_for<T>().contains_an_item_for(id))
- {
- return get_identity_map_for<T>().item_that_belongs_to(id);
- }
-
- var entity = database.fetch_all<T>().Single(x => x.id.Equals(id));
- get_identity_map_for<T>().add(id, entity);
- return entity;
- }
-
- public IEnumerable<T> all<T>() where T : Identifiable<Guid>
- {
- database
- .fetch_all<T>()
- .where(x => !get_identity_map_for<T>().contains_an_item_for(x.id))
- .each(x => get_identity_map_for<T>().add(x.id, x));
- return get_identity_map_for<T>().all();
- }
-
- public void save<T>(T entity) where T : Identifiable<Guid>
- {
- this.log().debug("saving {0}: {1}", id, entity);
- get_identity_map_for<T>().add(entity.id, entity);
- }
-
- public void delete<T>(T entity) where T : Identifiable<Guid>
- {
- get_identity_map_for<T>().evict(entity.id);
- }
-
- public void flush()
- {
- this.log().debug("flushing session {0}", id);
- transaction.commit_changes();
- transaction = null;
- }
-
- public bool is_dirty()
- {
- this.log().debug("is dirty? {0}", id);
- return null != transaction && transaction.is_dirty();
- }
-
- public void Dispose()
- {
- if (null != transaction) transaction.rollback_changes();
- }
-
- IIdentityMap<Guid, T> get_identity_map_for<T>() where T : Identifiable<Guid>
- {
- return identity_maps.ContainsKey(typeof (T))
- ? identity_maps[typeof (T)].downcast_to<IIdentityMap<Guid, T>>()
- : create_map_for<T>();
- }
-
- IIdentityMap<Guid, T> create_map_for<T>() where T : Identifiable<Guid>
- {
- var identity_map = transaction.create_for<T>();
- identity_maps.Add(typeof (T), identity_map);
- return identity_map;
- }
-
- public override string ToString()
- {
- return "session: {0}".formatted_using(id);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/SessionFactory.cs
@@ -1,23 +0,0 @@
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface ISessionFactory : Factory<ISession> {}
-
- public class SessionFactory : ISessionFactory
- {
- readonly IDatabase database;
- readonly IChangeTrackerFactory factory;
-
- public SessionFactory(IDatabase database, IChangeTrackerFactory factory)
- {
- this.database = database;
- this.factory = factory;
- }
-
- public ISession create()
- {
- return new Session(new Transaction(database, factory), database);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/SessionNotStartedException.cs
@@ -1,11 +0,0 @@
-using System;
-
-namespace momoney.database.transactions
-{
- public class SessionNotStartedException : Exception
- {
- public SessionNotStartedException() : base("A session could not be found. Did you forget to open a session?")
- {
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/SessionProvider.cs
@@ -1,25 +0,0 @@
-namespace momoney.database.transactions
-{
- public interface ISessionProvider
- {
- ISession get_the_current_session();
- }
-
- public class SessionProvider : ISessionProvider
- {
- readonly IContext context;
- readonly IKey<ISession> session_key;
-
- public SessionProvider(IContext context, IKey<ISession> session_key)
- {
- this.context = context;
- this.session_key = session_key;
- }
-
- public ISession get_the_current_session()
- {
- if (!context.contains(session_key)) throw new SessionNotStartedException();
- return context.value_for(session_key);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/TrackerEntry.cs
@@ -1,47 +0,0 @@
-using System.Reflection;
-using Gorilla.Commons.Infrastructure.Logging;
-
-namespace momoney.database.transactions
-{
- public interface ITrackerEntry<T>
- {
- T current { get; }
- bool has_changes();
- }
-
- public class TrackerEntry<T> : ITrackerEntry<T>
- {
- readonly T original;
-
- public TrackerEntry(T original, T current)
- {
- this.original = original;
- this.current = current;
- }
-
- public T current { get; set; }
-
- public bool has_changes()
- {
- this.log().debug("checking for changes");
- var type = original.GetType();
- foreach (var field in type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance))
- {
- var original_value = field.GetValue(original);
- var current_value = field.GetValue(current);
- if (original_value == null && current_value != null)
- {
- this.log().debug("{0} has changes: {1}", field, original);
- return true;
- }
- if (original_value != null && !original_value.Equals(current_value))
- {
- this.log().debug("{0} has changes: {1}", field, original);
- return true;
- }
- }
- this.log().debug("has no changes: {0}", original);
- return false;
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/TrackerEntryMapper.cs
@@ -1,27 +0,0 @@
-using Gorilla.Commons.Infrastructure.Cloning;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface ITrackerEntryMapper<T> : Mapper<T, ITrackerEntry<T>> {}
-
- public class TrackerEntryMapper<T> : ITrackerEntryMapper<T>
- {
- readonly IPrototype prototype;
-
- public TrackerEntryMapper(IPrototype prototype)
- {
- this.prototype = prototype;
- }
-
- public ITrackerEntry<T> map_from(T item)
- {
- return new TrackerEntry<T>(create_prototype(item), item);
- }
-
- T create_prototype(T item)
- {
- return prototype.clone(item);
- }
- }
-}
\ No newline at end of file
product/client/database/transactions/Transaction.cs
@@ -1,56 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using gorilla.commons.utility;
-
-namespace momoney.database.transactions
-{
- public interface ITransaction
- {
- IIdentityMap<Guid, T> create_for<T>() where T : Identifiable<Guid>;
- void commit_changes();
- void rollback_changes();
- bool is_dirty();
- }
-
- public class Transaction : ITransaction
- {
- readonly IDatabase database;
- readonly IChangeTrackerFactory factory;
- readonly IDictionary<Type, IChangeTracker> change_trackers;
-
- public Transaction(IDatabase database, IChangeTrackerFactory factory)
- {
- this.factory = factory;
- this.database = database;
- change_trackers = new Dictionary<Type, IChangeTracker>();
- }
-
- public IIdentityMap<Guid, T> create_for<T>() where T : Identifiable<Guid>
- {
- return new IdentityMapProxy<Guid, T>(get_change_tracker_for<T>(), new IdentityMap<Guid, T>());
- }
-
- public void commit_changes()
- {
- change_trackers.Values.where(x => x.is_dirty()).each(x => x.commit_to(database));
- }
-
- public void rollback_changes()
- {
- change_trackers.each(x => x.Value.Dispose());
- change_trackers.Clear();
- }
-
- public bool is_dirty()
- {
- return change_trackers.Values.Count(x => x.is_dirty()) > 0;
- }
-
- IChangeTracker<T> get_change_tracker_for<T>() where T : Identifiable<Guid>
- {
- if (!change_trackers.ContainsKey(typeof (T))) change_trackers.Add(typeof (T), factory.create_for<T>());
- return change_trackers[typeof (T)].downcast_to<IChangeTracker<T>>();
- }
- }
-}
\ No newline at end of file
product/client/database/database.csproj
@@ -74,51 +74,6 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
- <ItemGroup>
- <Compile Include="DatabaseAssembly.cs" />
- <Compile Include="db4o\ConfigureObjectContainerStep.cs" />
- <Compile Include="repositories\AccountHolderRepository.cs" />
- <Compile Include="repositories\BillRepository.cs" />
- <Compile Include="repositories\CompanyRepository.cs" />
- <Compile Include="repositories\IncomeRepository.cs" />
- <Compile Include="db4o\ConfigureDatabaseStep.cs" />
- <Compile Include="db4o\ConnectionFactory.cs" />
- <Compile Include="ObjectDatabase.cs" />
- <Compile Include="db4o\ObjectDatabaseConnection.cs" />
- <Compile Include="IConnectionFactory.cs" />
- <Compile Include="IDatabaseConfiguration.cs" />
- <Compile Include="transactions\ChangeTracker.cs" />
- <Compile Include="transactions\ChangeTrackerFactory.cs" />
- <Compile Include="transactions\Context.cs" />
- <Compile Include="transactions\ContextFactory.cs" />
- <Compile Include="transactions\CurrentThread.cs" />
- <Compile Include="transactions\DeleteFromDatabase.cs" />
- <Compile Include="transactions\IChangeTracker.cs" />
- <Compile Include="transactions\IChangeTrackerFactory.cs" />
- <Compile Include="transactions\IContext.cs" />
- <Compile Include="transactions\IDatabase.cs" />
- <Compile Include="transactions\DatabaseConnection.cs" />
- <Compile Include="transactions\IdentityMapProxy.cs" />
- <Compile Include="transactions\IIdentityMap.cs" />
- <Compile Include="transactions\IKey.cs" />
- <Compile Include="transactions\IScopedStorage.cs" />
- <Compile Include="transactions\DatabaseCommand.cs" />
- <Compile Include="transactions\DatabaseCommandRegistry.cs" />
- <Compile Include="transactions\IThread.cs" />
- <Compile Include="transactions\PerThread.cs" />
- <Compile Include="transactions\PerThreadScopedStorage.cs" />
- <Compile Include="transactions\SaveOrUpdateFromDatabase.cs" />
- <Compile Include="transactions\Session.cs" />
- <Compile Include="transactions\SessionFactory.cs" />
- <Compile Include="transactions\SessionNotStartedException.cs" />
- <Compile Include="transactions\SessionProvider.cs" />
- <Compile Include="transactions\SingletonScopedStorage.cs" />
- <Compile Include="transactions\ObjectDatabaseCommandRegistry.cs" />
- <Compile Include="transactions\TrackerEntry.cs" />
- <Compile Include="transactions\TrackerEntryMapper.cs" />
- <Compile Include="transactions\Transaction.cs" />
- <Compile Include="transactions\TypedKey.cs" />
- </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\commons\infrastructure\infrastructure.csproj">
<Project>{AA5EEED9-4531-45F7-AFCD-AD9717D2E405}</Project>
@@ -131,6 +86,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
+ <Folder Include="transactions\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
product/client/database/DatabaseAssembly.cs
@@ -1,7 +0,0 @@
-namespace momoney.database
-{
- public class DatabaseAssembly
- {
-
- }
-}
\ No newline at end of file
product/client/database/IConnectionFactory.cs
@@ -1,10 +0,0 @@
-using Gorilla.Commons.Infrastructure.FileSystem;
-using momoney.database.transactions;
-
-namespace momoney.database
-{
- public interface IConnectionFactory
- {
- DatabaseConnection open_connection_to(File the_path_to_the_database_file);
- }
-}
\ No newline at end of file
product/client/database/IDatabaseConfiguration.cs
@@ -1,11 +0,0 @@
-using Gorilla.Commons.Infrastructure.FileSystem;
-
-namespace momoney.database
-{
- public interface IDatabaseConfiguration
- {
- void open(File file);
- void copy_to(string path);
- void close(string name);
- }
-}
\ No newline at end of file
product/client/database/ObjectDatabase.cs
@@ -1,62 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using Gorilla.Commons.Infrastructure.FileSystem;
-using gorilla.commons.utility;
-using momoney.database.transactions;
-using File = Gorilla.Commons.Infrastructure.FileSystem.File;
-
-namespace momoney.database
-{
- public class ObjectDatabase : IDatabase, IDatabaseConfiguration
- {
- readonly IConnectionFactory factory;
- File path;
-
- public ObjectDatabase(IConnectionFactory factory)
- {
- this.factory = factory;
- path = new ApplicationFile(Path.GetTempFileName());
- }
-
- public IEnumerable<T> fetch_all<T>() where T : Identifiable<Guid>
- {
- using (var connection = factory.open_connection_to(path_to_database()))
- {
- return connection.query<T>().ToList();
- }
- }
-
- public void apply(DatabaseCommand command)
- {
- using (var connection = factory.open_connection_to(path_to_database()))
- {
- command.run_against(connection);
- connection.commit();
- }
- }
-
- public void open(File file)
- {
- path = new ApplicationFile(Path.GetTempFileName());
- file.copy_to(path.path);
- }
-
- public void copy_to(string new_path)
- {
- path.copy_to(new_path);
- }
-
- public void close(string name)
- {
- path.delete();
- path = new ApplicationFile(Path.GetTempFileName());
- }
-
- File path_to_database()
- {
- return path;
- }
- }
-}
\ No newline at end of file
product/client/presentation.windows/bootstrappers/Bootstrapper.cs
@@ -7,14 +7,12 @@ using Gorilla.Commons.Infrastructure.Container;
using Gorilla.Commons.Infrastructure.Logging;
using gorilla.commons.infrastructure.thirdparty.Autofac;
using gorilla.commons.infrastructure.thirdparty.Log4Net;
+using gorilla.commons.infrastructure.threading;
using gorilla.commons.utility;
-using MoMoney.Service.Infrastructure.Eventing;
-using MoMoney.Service.Infrastructure.Threading;
using presentation.windows.common;
using presentation.windows.common.messages;
+using presentation.windows.eventing;
using presentation.windows.presenters;
-using presentation.windows.queries;
-using presentation.windows.service.infrastructure;
using presentation.windows.views;
using Rhino.Queues;
@@ -66,13 +64,11 @@ namespace presentation.windows.bootstrappers
builder.Register<CancelCommand>();
// commanding
- builder.Register<ContainerCommandBuilder>().As<CommandBuilder>().SingletonScoped();
builder.Register<AsynchronousCommandProcessor>().As<CommandProcessor>().SingletonScoped();
//builder.Register<SynchronousCommandProcessor>().As<CommandProcessor>().SingletonScoped();
builder.Register<WpfCommandBuilder>().As<UICommandBuilder>();
// queries
- builder.Register<ContainerAwareQueryBuilder>().As<QueryBuilder>();
builder.Register<PublishEventHandler<AddedNewFamilyMember>>().As<Handler>();
product/client/presentation.windows/bootstrappers/ConfigureMappings.cs
@@ -1,7 +1,7 @@
using AutoMapper;
using presentation.windows.common;
using presentation.windows.common.messages;
-using presentation.windows.queries;
+using presentation.windows.presenters;
namespace presentation.windows.bootstrappers
{
product/client/presentation.windows/bootstrappers/PublishEventHandler.cs
@@ -1,5 +1,5 @@
-using MoMoney.Service.Infrastructure.Eventing;
-using presentation.windows.common;
+using presentation.windows.common;
+using presentation.windows.eventing;
namespace presentation.windows.bootstrappers
{
product/client/presentation.windows/bootstrappers/StartServiceBus.cs
@@ -1,5 +1,5 @@
using Gorilla.Commons.Infrastructure.Container;
-using MoMoney.Service.Infrastructure.Threading;
+using gorilla.commons.infrastructure.threading;
using presentation.windows.common;
using presentation.windows.common.messages;
product/client/service.infrastructure/eventing/EventAggregator.cs → product/client/presentation.windows/eventing/EventAggregator.cs
@@ -1,13 +1,14 @@
-using System;
-
-namespace MoMoney.Service.Infrastructure.Eventing
-{
- public interface EventAggregator
- {
- void subscribe_to<Event>(EventSubscriber<Event> subscriber) where Event : IEvent;
- void subscribe<Listener>(Listener subscriber);
- void publish<Event>(Event the_event_to_broadcast) where Event : IEvent;
- void publish<T>(Action<T> call) where T : class;
- void publish<Event>() where Event : IEvent, new();
- }
+using System;
+using presentation.windows.common;
+
+namespace presentation.windows.eventing
+{
+ public interface EventAggregator
+ {
+ void subscribe_to<Event>(EventSubscriber<Event> subscriber) where Event : IEvent;
+ void subscribe<Listener>(Listener subscriber);
+ void publish<Event>(Event the_event_to_broadcast) where Event : IEvent;
+ void publish<T>(Action<T> call) where T : class;
+ void publish<Event>() where Event : IEvent, new();
+ }
}
\ No newline at end of file
product/client/service.infrastructure/eventing/EventSubscriber.cs → product/client/presentation.windows/eventing/EventSubscriber.cs
@@ -1,7 +1,9 @@
-namespace MoMoney.Service.Infrastructure.Eventing
-{
- public interface EventSubscriber<Event> where Event : IEvent
- {
- void notify(Event message);
- }
+using presentation.windows.common;
+
+namespace presentation.windows.eventing
+{
+ public interface EventSubscriber<Event> where Event : IEvent
+ {
+ void notify(Event message);
+ }
}
\ No newline at end of file
product/client/service.infrastructure/eventing/SynchronizedEventAggregator.cs → product/client/presentation.windows/eventing/SynchronizedEventAggregator.cs
@@ -1,57 +1,58 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using gorilla.commons.utility;
-
-namespace MoMoney.Service.Infrastructure.Eventing
-{
- public class SynchronizedEventAggregator : EventAggregator
- {
- readonly SynchronizationContext context;
- readonly HashSet<object> subscribers = new HashSet<object>();
- readonly object mutex = new object();
-
- public SynchronizedEventAggregator(SynchronizationContext context)
- {
- this.context = context;
- }
-
- public void subscribe_to<Event>(EventSubscriber<Event> subscriber) where Event : IEvent
- {
- subscribe(subscriber);
- }
-
- public void subscribe<Listener>(Listener subscriber)
- {
- within_lock(() => subscribers.Add(subscriber));
- }
-
- public void publish<Event>(Event the_event_to_broadcast) where Event : IEvent
- {
- var current_subscribers = subscribers.ToList();
- process(() => current_subscribers.call_on_each<EventSubscriber<Event>>(x => x.notify(the_event_to_broadcast)));
- }
-
- public void publish<T>(Action<T> call) where T : class
- {
- var current_subscribers = subscribers.ToList();
- process(() => current_subscribers.each(x => x.call_on(call)));
- }
-
- public void publish<Event>() where Event : IEvent, new()
- {
- publish(new Event());
- }
-
- void within_lock(Action action)
- {
- lock (mutex) action();
- }
-
- void process(Action action)
- {
- context.Send(x => action(), new object());
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using gorilla.commons.utility;
+using presentation.windows.common;
+
+namespace presentation.windows.eventing
+{
+ public class SynchronizedEventAggregator : EventAggregator
+ {
+ readonly SynchronizationContext context;
+ readonly HashSet<object> subscribers = new HashSet<object>();
+ readonly object mutex = new object();
+
+ public SynchronizedEventAggregator(SynchronizationContext context)
+ {
+ this.context = context;
+ }
+
+ public void subscribe_to<Event>(EventSubscriber<Event> subscriber) where Event : IEvent
+ {
+ subscribe(subscriber);
+ }
+
+ public void subscribe<Listener>(Listener subscriber)
+ {
+ within_lock(() => subscribers.Add(subscriber));
+ }
+
+ public void publish<Event>(Event the_event_to_broadcast) where Event : IEvent
+ {
+ var current_subscribers = subscribers.ToList();
+ process(() => current_subscribers.call_on_each<EventSubscriber<Event>>(x => x.notify(the_event_to_broadcast)));
+ }
+
+ public void publish<T>(Action<T> call) where T : class
+ {
+ var current_subscribers = subscribers.ToList();
+ process(() => current_subscribers.each(x => x.call_on(call)));
+ }
+
+ public void publish<Event>() where Event : IEvent, new()
+ {
+ publish(new Event());
+ }
+
+ void within_lock(Action action)
+ {
+ lock (mutex) action();
+ }
+
+ void process(Action action)
+ {
+ context.Send(x => action(), new object());
+ }
+ }
}
\ No newline at end of file
product/client/presentation.windows/events/SelectedFamilyMember.cs
@@ -1,5 +1,5 @@
using System;
-using MoMoney.Service.Infrastructure.Eventing;
+using presentation.windows.common;
namespace presentation.windows.events
{
product/client/presentation.windows/service/infrastructure/UpdateOnLongRunningProcess.cs → product/client/presentation.windows/events/UpdateOnLongRunningProcess.cs
@@ -1,6 +1,6 @@
-using MoMoney.Service.Infrastructure.Eventing;
+using presentation.windows.common;
-namespace presentation.windows.service.infrastructure
+namespace presentation.windows.events
{
public class UpdateOnLongRunningProcess : IEvent
{
product/client/presentation.windows/presenters/CompensationPresenter.cs
@@ -1,4 +1,4 @@
-using MoMoney.Service.Infrastructure.Eventing;
+using presentation.windows.eventing;
using presentation.windows.events;
namespace presentation.windows.presenters
product/client/presentation.windows/queries/PersonDetails.cs → product/client/presentation.windows/presenters/PersonDetails.cs
@@ -1,7 +1,7 @@
using System;
using gorilla.commons.utility;
-namespace presentation.windows.queries
+namespace presentation.windows.presenters
{
public class PersonDetails
{
product/client/presentation.windows/presenters/SelectedFamilyMemberPresenter.cs
@@ -1,11 +1,10 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using gorilla.commons.utility;
-using MoMoney.Service.Infrastructure.Eventing;
using presentation.windows.common;
using presentation.windows.common.messages;
+using presentation.windows.eventing;
using presentation.windows.events;
-using presentation.windows.queries;
namespace presentation.windows.presenters
{
product/client/presentation.windows/presenters/StatusBarPresenter.cs
@@ -1,6 +1,6 @@
using System.Threading;
-using MoMoney.Service.Infrastructure.Eventing;
-using presentation.windows.service.infrastructure;
+using presentation.windows.eventing;
+using presentation.windows.events;
namespace presentation.windows.presenters
{
product/client/presentation.windows/queries/ContainerAwareQueryBuilder.cs
@@ -1,25 +0,0 @@
-using System;
-using Gorilla.Commons.Infrastructure.Container;
-using momoney.service.infrastructure.transactions;
-
-namespace presentation.windows.queries
-{
- public class ContainerAwareQueryBuilder : QueryBuilder
- {
- IUnitOfWorkFactory factory;
-
- public ContainerAwareQueryBuilder(IUnitOfWorkFactory factory)
- {
- this.factory = factory;
- }
-
- public void build<Query>(Action<Query> action) where Query : class
- {
- using (var unit_of_work = factory.create())
- {
- action(Resolve.the<Query>());
- unit_of_work.commit();
- }
- }
- }
-}
\ No newline at end of file
product/client/presentation.windows/queries/QueryBuilder.cs
@@ -1,9 +0,0 @@
-using System;
-
-namespace presentation.windows.queries
-{
- public interface QueryBuilder
- {
- void build<Query>(Action<Query> action) where Query : class;
- }
-}
\ No newline at end of file
product/client/presentation.windows/service/infrastructure/CommandBuilder.cs
@@ -1,15 +0,0 @@
-using gorilla.commons.utility;
-
-namespace presentation.windows.service.infrastructure
-{
- public interface CommandBuilder
- {
- CommandBuilder<TData> prepare<TData>(TData data);
- Command build<TCommand>(string message) where TCommand : Command;
- }
-
- public interface CommandBuilder<T>
- {
- Command build<TCommand>(string message) where TCommand : Command<T>;
- }
-}
\ No newline at end of file
product/client/presentation.windows/service/infrastructure/ContainerAwareCommandBuilder.cs
@@ -1,52 +0,0 @@
-using System;
-using Gorilla.Commons.Infrastructure.Container;
-using gorilla.commons.utility;
-using MoMoney.Service.Infrastructure.Eventing;
-using momoney.service.infrastructure.transactions;
-
-namespace presentation.windows.service.infrastructure
-{
- public class ContainerAwareCommandBuilder<T> : CommandBuilder<T>, Command
- {
- readonly T data;
- Action action;
- EventAggregator event_broker;
- IUnitOfWorkFactory factory;
-
- public ContainerAwareCommandBuilder(T data, EventAggregator event_broker, IUnitOfWorkFactory factory)
- {
- this.data = data;
- this.factory = factory;
- this.event_broker = event_broker;
- }
-
- public Command build<TCommand>(string message) where TCommand : Command<T>
- {
- action = () =>
- {
- event_broker.publish(new UpdateOnLongRunningProcess
- {
- message = message,
- percent_complete = 0,
- });
- //need to resolve the command on the background thread in order to resolve the thread specific session.
- Resolve.the<TCommand>().run_against(data);
- event_broker.publish(new UpdateOnLongRunningProcess
- {
- percent_complete = 100,
- });
- };
-
- return this;
- }
-
- public void run()
- {
- using (var unit_of_work = factory.create())
- {
- action();
- unit_of_work.commit();
- }
- }
- }
-}
\ No newline at end of file
product/client/presentation.windows/service/infrastructure/ContainerCommandBuilder.cs
@@ -1,29 +0,0 @@
-using Gorilla.Commons.Infrastructure.Container;
-using gorilla.commons.utility;
-using MoMoney.Service.Infrastructure.Eventing;
-using momoney.service.infrastructure.transactions;
-
-namespace presentation.windows.service.infrastructure
-{
- public class ContainerCommandBuilder : CommandBuilder
- {
- EventAggregator event_aggregator;
- IUnitOfWorkFactory unit_of_work_factory;
-
- public ContainerCommandBuilder(EventAggregator event_aggregator, IUnitOfWorkFactory unit_of_work_factory)
- {
- this.event_aggregator = event_aggregator;
- this.unit_of_work_factory = unit_of_work_factory;
- }
-
- public CommandBuilder<T> prepare<T>(T data)
- {
- return new ContainerAwareCommandBuilder<T>(data, event_aggregator, unit_of_work_factory);
- }
-
- public Command build<T>(string message) where T : Command
- {
- return new NamedCommand<T>(message, Resolve.the<T>());
- }
- }
-}
\ No newline at end of file
product/client/presentation.windows/service/infrastructure/NamedCommand.cs
@@ -1,26 +0,0 @@
-using gorilla.commons.utility;
-
-namespace presentation.windows.service.infrastructure
-{
- public class NamedCommand<T> : Command where T : Command
- {
- readonly string message;
- readonly T command;
-
- public NamedCommand(string message, T command)
- {
- this.message = message;
- this.command = command;
- }
-
- public void run()
- {
- command.run();
- }
-
- public override string ToString()
- {
- return message;
- }
- }
-}
\ No newline at end of file
product/client/presentation.windows/views/MenuItemExtensions.cs
@@ -1,6 +1,5 @@
using System;
using System.Windows.Controls;
-using presentation.windows.presenters;
namespace presentation.windows.views
{
product/client/presentation.windows/views/ShellWIndow.xaml
@@ -1,13 +1,10 @@
-<Window x:Class="presentation.windows.views.ShellWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:presentation.windows.views" Title="MoMoney - (ALPHA)" MinWidth="1024" MinHeight="768" WindowStartupLocation="CenterScreen" WindowState="Maximized">
- <DockPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
- <ui:MainMenu x:Name="Menu" DockPanel.Dock="Top" HorizontalAlignment="Right">
- </ui:MainMenu>
- <ui:StatusBarRegion x:Name="StatusBar" DockPanel.Dock="Bottom"></ui:StatusBarRegion>
- <StackPanel>
- <ui:SelectedFamilyMemberRegion x:Name="SelectedFamilyMember"></ui:SelectedFamilyMemberRegion>
- <TabControl Name="Tabs"></TabControl>
- </StackPanel>
- </DockPanel>
-</Window>
+<Window x:Class="presentation.windows.views.ShellWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:presentation.windows.views" Title="MoMoney - (ALPHA)" MinWidth="1024" MinHeight="768" WindowStartupLocation="CenterScreen" WindowState="Maximized">
+ <DockPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <ui:MainMenu x:Name="Menu" DockPanel.Dock="Top" HorizontalAlignment="Right"></ui:MainMenu>
+ <ui:StatusBarRegion x:Name="StatusBar" DockPanel.Dock="Bottom"></ui:StatusBarRegion>
+ <StackPanel>
+ <ui:SelectedFamilyMemberRegion x:Name="SelectedFamilyMember"></ui:SelectedFamilyMemberRegion>
+ <TabControl Name="Tabs"></TabControl>
+ </StackPanel>
+ </DockPanel>
+</Window>
\ No newline at end of file
product/client/presentation.windows/presenters/CancelCommand.cs → product/client/presentation.windows/CancelCommand.cs
@@ -1,4 +1,4 @@
-namespace presentation.windows.presenters
+namespace presentation.windows
{
public class CancelCommand : UICommand<DialogPresenter>
{
product/client/presentation.windows/presentation.windows.csproj → product/client/presentation.windows/client.csproj
@@ -149,6 +149,9 @@
<SubType>Designer</SubType>
</Page>
<Compile Include="bootstrappers\PublishEventHandler.cs" />
+ <Compile Include="eventing\EventAggregator.cs" />
+ <Compile Include="eventing\EventSubscriber.cs" />
+ <Compile Include="eventing\SynchronizedEventAggregator.cs" />
<Compile Include="views\ShellWindow.xaml.cs">
<DependentUpon>ShellWindow.xaml</DependentUpon>
<SubType>Code</SubType>
@@ -160,28 +163,22 @@
<Compile Include="bootstrappers\ConfigureMappings.cs" />
<Compile Include="bootstrappers\StartServiceBus.cs" />
<Compile Include="events\SelectedFamilyMember.cs" />
- <Compile Include="service\infrastructure\UpdateOnLongRunningProcess.cs" />
+ <Compile Include="events\UpdateOnLongRunningProcess.cs" />
<Compile Include="Dialog.cs" />
<Compile Include="DialogPresenter.cs" />
<Compile Include="presenters\AccountPresenter.cs" />
<Compile Include="presenters\AddFamilyMemberPresenter.cs" />
- <Compile Include="service\infrastructure\CommandBuilder.cs" />
<Compile Include="presenters\AddNewAccountPresenter.cs" />
- <Compile Include="presenters\CancelCommand.cs" />
+ <Compile Include="CancelCommand.cs" />
<Compile Include="presenters\CompensationPresenter.cs" />
- <Compile Include="service\infrastructure\ContainerCommandBuilder.cs" />
- <Compile Include="service\infrastructure\NamedCommand.cs" />
- <Compile Include="service\infrastructure\ContainerAwareCommandBuilder.cs" />
- <Compile Include="presenters\UICommand.cs" />
- <Compile Include="presenters\UICommandBuilder.cs" />
+ <Compile Include="UICommand.cs" />
+ <Compile Include="UICommandBuilder.cs" />
<Compile Include="presenters\WpfBindingExtensinos.cs" />
<Compile Include="presenters\WpfCommandBuilder.cs" />
- <Compile Include="queries\ContainerAwareQueryBuilder.cs" />
<Compile Include="presenters\SelectedFamilyMemberPresenter.cs" />
<Compile Include="presenters\StatusBarPresenter.cs" />
- <Compile Include="presenters\Observable.cs" />
- <Compile Include="queries\PersonDetails.cs" />
- <Compile Include="queries\QueryBuilder.cs" />
+ <Compile Include="Observable.cs" />
+ <Compile Include="presenters\PersonDetails.cs" />
<Compile Include="View.cs" />
<Compile Include="views\AccountTab.xaml.cs">
<DependentUpon>AccountTab.xaml</DependentUpon>
@@ -215,7 +212,7 @@
</Compile>
<Compile Include="Tab.cs" />
<Compile Include="TabPresenter.cs" />
- <Compile Include="presenters\IObservableCommand.cs" />
+ <Compile Include="IObservableCommand.cs" />
<Compile Include="views\ErrorWindow.xaml.cs">
<DependentUpon>ErrorWindow.xaml</DependentUpon>
</Compile>
@@ -224,7 +221,7 @@
</Compile>
<Compile Include="views\MainMenu.cs" />
<Compile Include="views\MenuItemExtensions.cs" />
- <Compile Include="presenters\SimpleCommand.cs" />
+ <Compile Include="SimpleCommand.cs" />
<Compile Include="views\StatusBarRegion.xaml.cs">
<DependentUpon>StatusBarRegion.xaml</DependentUpon>
</Compile>
@@ -258,9 +255,9 @@
<Project>{DD8FD29E-7424-415C-9BA3-7D9F6ECBA161}</Project>
<Name>utility</Name>
</ProjectReference>
- <ProjectReference Include="..\..\presentation.windows.common\presentation.windows.common.csproj">
+ <ProjectReference Include="..\..\presentation.windows.common\common.csproj">
<Project>{72B22B1E-1B62-41A6-9392-BD5283D17F79}</Project>
- <Name>presentation.windows.common</Name>
+ <Name>common</Name>
</ProjectReference>
<ProjectReference Include="..\service.infrastructure\service.infrastructure.csproj">
<Project>{81412692-F3EE-4FBF-A7C7-69454DD1BD46}</Project>
@@ -305,9 +302,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
- <Folder Include="infrastructure\" />
- <Folder Include="service\application\" />
- <Folder Include="service\domain\" />
+ <Folder Include="presentation\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
product/client/presentation.windows/presenters/IObservableCommand.cs → product/client/presentation.windows/IObservableCommand.cs
@@ -1,6 +1,6 @@
using System.Windows.Input;
-namespace presentation.windows.presenters
+namespace presentation.windows
{
public interface IObservableCommand : ICommand
{
product/client/presentation.windows/presenters/Observable.cs → product/client/presentation.windows/Observable.cs
@@ -3,7 +3,7 @@ using System.ComponentModel;
using System.Linq.Expressions;
using gorilla.commons.utility;
-namespace presentation.windows.presenters
+namespace presentation.windows
{
public abstract class Observable<T> : INotifyPropertyChanged
{
product/client/presentation.windows/presenters/SimpleCommand.cs → product/client/presentation.windows/SimpleCommand.cs
@@ -1,6 +1,6 @@
using System;
-namespace presentation.windows.presenters
+namespace presentation.windows
{
public class SimpleCommand : IObservableCommand
{
product/client/presentation.windows/presenters/UICommand.cs → product/client/presentation.windows/UICommand.cs
@@ -1,4 +1,4 @@
-namespace presentation.windows.presenters
+namespace presentation.windows
{
public interface UICommand
{
product/client/presentation.windows/presenters/UICommandBuilder.cs → product/client/presentation.windows/UICommandBuilder.cs
@@ -1,4 +1,4 @@
-namespace presentation.windows.presenters
+namespace presentation.windows
{
public interface UICommandBuilder
{
product/client/presentation.windows/WpfApplicationController.cs
@@ -1,6 +1,6 @@
using System.Windows;
using System.Windows.Controls;
-using MoMoney.Service.Infrastructure.Eventing;
+using presentation.windows.eventing;
namespace presentation.windows
{
product/client/service.infrastructure/debugging/Launch.cs
@@ -1,26 +0,0 @@
-using System;
-using System.Diagnostics;
-
-namespace MoMoney.Service.Infrastructure.debugging
-{
- static public class Launch
- {
- static public void the_debugger()
- {
-#if DEBUG
- if (Debugger.IsAttached) Debugger.Break();
- else Debugger.Launch();
-#endif
- }
-
- static public void the_debugger_if(Func<bool> condition)
- {
-#if DEBUG
- if (!condition()) return;
-
- if (Debugger.IsAttached) Debugger.Break();
- else Debugger.Launch();
-#endif
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/eventing/IEvent.cs
@@ -1,6 +0,0 @@
-namespace MoMoney.Service.Infrastructure.Eventing
-{
- public interface IEvent
- {
- }
-}
\ No newline at end of file
product/client/service.infrastructure/logging/ILogFileTasks.cs
@@ -1,8 +0,0 @@
-namespace momoney.service.infrastructure.logging
-{
- public interface ILogFileTasks
- {
- string get_the_contents_of_the_log_file();
- string get_the_path_to_the_log_file();
- }
-}
\ No newline at end of file
product/client/service.infrastructure/logging/LogFileTasks.cs
@@ -1,27 +0,0 @@
-using System.IO;
-using Gorilla.Commons.Infrastructure.Reflection;
-using momoney.service.infrastructure.logging;
-
-namespace MoMoney.Service.Infrastructure.Logging
-{
- public class LogFileTasks : ILogFileTasks
- {
- public string get_the_contents_of_the_log_file()
- {
- using (
- var file_stream = new FileStream(get_the_path_to_the_log_file(), FileMode.Open, FileAccess.Read,
- FileShare.ReadWrite))
- {
- using (var reader = new StreamReader(file_stream))
- {
- return reader.ReadToEnd();
- }
- }
- }
-
- public string get_the_path_to_the_log_file()
- {
- return Path.Combine(this.startup_directory(), @"logs\log.txt");
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/security/IsInRole.cs
@@ -1,20 +0,0 @@
-using System.Security.Principal;
-using gorilla.commons.utility;
-
-namespace MoMoney.Service.Infrastructure.Security
-{
- public class IsInRole : Specification<IPrincipal>
- {
- readonly Role role;
-
- public IsInRole(Role role)
- {
- this.role = role;
- }
-
- public bool is_satisfied_by(IPrincipal item)
- {
- return item.IsInRole(role);
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/security/Role.cs
@@ -1,42 +0,0 @@
-namespace MoMoney.Service.Infrastructure.Security
-{
- public class Role
- {
- readonly string name;
-
- public Role(string name)
- {
- this.name = name;
- }
-
- static public implicit operator string(Role role)
- {
- return role.name;
- }
-
- static public implicit operator Role(string role)
- {
- return new Role(role);
- }
-
- public bool Equals(Role other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return Equals(other.name, name);
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Role)) return false;
- return Equals((Role) obj);
- }
-
- public override int GetHashCode()
- {
- return (name != null ? name.GetHashCode() : 0);
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/threading/RaiseEventInterceptor.cs
@@ -1,25 +0,0 @@
-using Castle.Core.Interceptor;
-using MoMoney.Service.Infrastructure.Eventing;
-
-namespace momoney.service.infrastructure.threading
-{
- public interface IRaiseEventInterceptor<Event> : IInterceptor where Event : IEvent, new()
- {
- }
-
- public class RaiseEventInterceptor<Event> : IRaiseEventInterceptor<Event> where Event : IEvent, new()
- {
- readonly EventAggregator broker;
-
- public RaiseEventInterceptor(EventAggregator broker)
- {
- this.broker = broker;
- }
-
- public void Intercept(IInvocation invocation)
- {
- invocation.Proceed();
- broker.publish(new Event());
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/threading/RunOnBackgroundThreadInterceptor.cs
@@ -1,24 +0,0 @@
-using Castle.Core.Interceptor;
-using gorilla.commons.Utility;
-
-namespace momoney.service.infrastructure.threading
-{
- public class RunOnBackgroundThreadInterceptor<CommandToExecute> : IInterceptor
- where CommandToExecute : DisposableCommand
- {
- readonly IBackgroundThreadFactory thread_factory;
-
- public RunOnBackgroundThreadInterceptor(IBackgroundThreadFactory thread_factory)
- {
- this.thread_factory = thread_factory;
- }
-
- public virtual void Intercept(IInvocation invocation)
- {
- using (thread_factory.create_for<CommandToExecute>())
- {
- invocation.Proceed();
- }
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/threading/RunOnUIThread.cs
@@ -1,23 +0,0 @@
-using Castle.Core.Interceptor;
-using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy;
-using gorilla.commons.utility;
-
-namespace momoney.service.infrastructure.threading
-{
- public class RunOnUIThread : IInterceptor
- {
- readonly ISynchronizationContextFactory factory;
-
- public RunOnUIThread() : this(Lazy.load<ISynchronizationContextFactory>()) {}
-
- public RunOnUIThread(ISynchronizationContextFactory factory)
- {
- this.factory = factory;
- }
-
- public void Intercept(IInvocation invocation)
- {
- factory.create().run_against(new AnonymousCommand(invocation.Proceed));
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/threading/WorkItem.cs
@@ -1,93 +0,0 @@
-using System;
-using System.Threading;
-
-namespace momoney.service.infrastructure.threading
-{
- [Serializable]
- internal class WorkItem : IAsyncResult
- {
- readonly object[] args;
- readonly object async_state;
- bool completed;
- readonly Delegate method;
- readonly ManualResetEvent reset_event;
- object returned_value;
-
- internal WorkItem(object async_state, Delegate method, object[] args)
- {
- this.async_state = async_state;
- this.method = method;
- this.args = args;
- reset_event = new ManualResetEvent(false);
- completed = false;
- }
-
- //IAsyncResult properties
- object IAsyncResult.AsyncState
- {
- get { return async_state; }
- }
-
- WaitHandle IAsyncResult.AsyncWaitHandle
- {
- get { return reset_event; }
- }
-
- bool IAsyncResult.CompletedSynchronously
- {
- get { return false; }
- }
-
- bool IAsyncResult.IsCompleted
- {
- get { return Completed; }
- }
-
- bool Completed
- {
- get
- {
- lock (this)
- {
- return completed;
- }
- }
- set
- {
- lock (this)
- {
- completed = value;
- }
- }
- }
-
- //This method is called on the worker thread to execute the method
- internal void CallBack()
- {
- MethodReturnedValue = method.DynamicInvoke(args);
- //Method is done. Signal the world
- reset_event.Set();
- Completed = true;
- }
-
- internal object MethodReturnedValue
- {
- get
- {
- object method_returned_value;
- lock (this)
- {
- method_returned_value = returned_value;
- }
- return method_returned_value;
- }
- set
- {
- lock (this)
- {
- returned_value = value;
- }
- }
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/transactions/UnitOfWork.cs
@@ -1,35 +0,0 @@
-using momoney.database.transactions;
-using momoney.service.infrastructure.transactions;
-
-namespace MoMoney.Service.Infrastructure.Transactions
-{
- public class UnitOfWork : IUnitOfWork
- {
- readonly ISession session;
- readonly IContext context;
- readonly IKey<ISession> key;
-
- public UnitOfWork(ISession session, IContext context, IKey<ISession> key)
- {
- this.session = session;
- this.context = context;
- this.key = key;
- }
-
- public void commit()
- {
- if (is_dirty()) session.flush();
- }
-
- public bool is_dirty()
- {
- return session.is_dirty();
- }
-
- public void Dispose()
- {
- context.remove(key);
- session.Dispose();
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/transactions/UnitOfWorkFactory.cs
@@ -1,36 +0,0 @@
-using momoney.database.transactions;
-using momoney.service.infrastructure.transactions;
-
-namespace MoMoney.Service.Infrastructure.Transactions
-{
- public class UnitOfWorkFactory : IUnitOfWorkFactory
- {
- readonly IContext context;
- readonly ISessionFactory factory;
- readonly IKey<ISession> key;
-
- public UnitOfWorkFactory(IContext context, ISessionFactory factory, IKey<ISession> key)
- {
- this.context = context;
- this.key = key;
- this.factory = factory;
- }
-
- public IUnitOfWork create()
- {
- return unit_of_work_been_started() ? new EmptyUnitOfWork() : start_a_new_unit_of_work();
- }
-
- bool unit_of_work_been_started()
- {
- return context.contains(key);
- }
-
- IUnitOfWork start_a_new_unit_of_work()
- {
- var session = factory.create();
- context.add(key, session);
- return new UnitOfWork(session, context, key);
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/CancelUpdate.cs
@@ -1,20 +0,0 @@
-using momoney.service.infrastructure.updating;
-
-namespace MoMoney.Service.Infrastructure.Updating
-{
- public class CancelUpdate : ICancelUpdate
- {
- readonly IDeployment deployment;
-
- public CancelUpdate(IDeployment deployment)
- {
- this.deployment = deployment;
- }
-
- public void run()
- {
- if (null == deployment) return;
- deployment.UpdateAsyncCancel();
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/CurrentDeployment.cs
@@ -1,163 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Deployment.Application;
-using MoMoney.Service.Infrastructure.Updating;
-
-namespace momoney.service.infrastructure.updating
-{
- public class CurrentDeployment : IDeployment
- {
- readonly ApplicationDeployment deployment;
-
- public CurrentDeployment()
- {
- deployment = ApplicationDeployment.CurrentDeployment;
- }
-
- public UpdateCheckInfo CheckForDetailedUpdate()
- {
- return deployment.CheckForDetailedUpdate();
- }
-
- public UpdateCheckInfo CheckForDetailedUpdate(bool persistUpdateCheckResult)
- {
- return deployment.CheckForDetailedUpdate(persistUpdateCheckResult);
- }
-
- public bool CheckForUpdate()
- {
- return deployment.CheckForUpdate();
- }
-
- public bool CheckForUpdate(bool persistUpdateCheckResult)
- {
- return deployment.CheckForUpdate(persistUpdateCheckResult);
- }
-
- public void CheckForUpdateAsync()
- {
- deployment.CheckForUpdateAsync();
- }
-
- public void CheckForUpdateAsyncCancel()
- {
- deployment.CheckForUpdateAsyncCancel();
- }
-
- public bool Update()
- {
- return deployment.Update();
- }
-
- public void UpdateAsync()
- {
- deployment.UpdateAsync();
- }
-
- public void UpdateAsyncCancel()
- {
- deployment.UpdateAsyncCancel();
- }
-
- public void DownloadFileGroup(string groupName)
- {
- deployment.DownloadFileGroup(groupName);
- }
-
- public void DownloadFileGroupAsync(string groupName)
- {
- deployment.DownloadFileGroupAsync(groupName);
- }
-
- public void DownloadFileGroupAsync(string groupName, object userState)
- {
- deployment.DownloadFileGroupAsync(groupName, userState);
- }
-
- public bool IsFileGroupDownloaded(string groupName)
- {
- return deployment.IsFileGroupDownloaded(groupName);
- }
-
- public void DownloadFileGroupAsyncCancel(string groupName)
- {
- deployment.DownloadFileGroupAsyncCancel(groupName);
- }
-
- public Version CurrentVersion
- {
- get { return deployment.CurrentVersion; }
- }
-
- public Version UpdatedVersion
- {
- get { return deployment.UpdatedVersion; }
- }
-
- public string UpdatedApplicationFullName
- {
- get { return deployment.UpdatedApplicationFullName; }
- }
-
- public DateTime TimeOfLastUpdateCheck
- {
- get { return deployment.TimeOfLastUpdateCheck; }
- }
-
- public Uri UpdateLocation
- {
- get { return deployment.UpdateLocation; }
- }
-
- public Uri ActivationUri
- {
- get { return deployment.ActivationUri; }
- }
-
- public string DataDirectory
- {
- get { return deployment.DataDirectory; }
- }
-
- public bool IsFirstRun
- {
- get { return deployment.IsFirstRun; }
- }
-
- public event DeploymentProgressChangedEventHandler CheckForUpdateProgressChanged
- {
- add { deployment.CheckForUpdateProgressChanged += value; }
- remove { deployment.CheckForUpdateProgressChanged -= value; }
- }
-
- public event CheckForUpdateCompletedEventHandler CheckForUpdateCompleted
- {
- add { deployment.CheckForUpdateCompleted += value; }
- remove { deployment.CheckForUpdateCompleted -= value; }
- }
-
- public event DeploymentProgressChangedEventHandler UpdateProgressChanged
- {
- add { deployment.UpdateProgressChanged += value; }
- remove { deployment.UpdateProgressChanged -= value; }
- }
-
- public event AsyncCompletedEventHandler UpdateCompleted
- {
- add { deployment.UpdateCompleted += value; }
- remove { deployment.UpdateCompleted -= value; }
- }
-
- public event DeploymentProgressChangedEventHandler DownloadFileGroupProgressChanged
- {
- add { deployment.DownloadFileGroupProgressChanged += value; }
- remove { deployment.DownloadFileGroupProgressChanged -= value; }
- }
-
- public event DownloadFileGroupCompletedEventHandler DownloadFileGroupCompleted
- {
- add { deployment.DownloadFileGroupCompleted += value; }
- remove { deployment.DownloadFileGroupCompleted -= value; }
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/DownloadTheLatestVersion.cs
@@ -1,23 +0,0 @@
-using gorilla.commons.utility;
-using Gorilla.Commons.Utility;
-using momoney.service.infrastructure.updating;
-
-namespace MoMoney.Service.Infrastructure.Updating
-{
- public class DownloadTheLatestVersion : IDownloadTheLatestVersion
- {
- readonly IDeployment deployment;
-
- public DownloadTheLatestVersion(IDeployment deployment)
- {
- this.deployment = deployment;
- }
-
- public void run_against(Callback<Percent> callback)
- {
- deployment.UpdateProgressChanged += (o, e) => callback.run_against(new Percent(e.BytesCompleted, e.BytesTotal));
- deployment.UpdateCompleted += (sender, args) => callback.run_against(100);
- deployment.UpdateAsync();
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/ICancelUpdate.cs
@@ -1,6 +0,0 @@
-using gorilla.commons.utility;
-
-namespace momoney.service.infrastructure.updating
-{
- public interface ICancelUpdate : Command {}
-}
\ No newline at end of file
product/client/service.infrastructure/updating/IDeployment.cs
@@ -1,38 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Deployment.Application;
-
-namespace MoMoney.Service.Infrastructure.Updating
-{
- public interface IDeployment
- {
- UpdateCheckInfo CheckForDetailedUpdate();
- UpdateCheckInfo CheckForDetailedUpdate(bool persistUpdateCheckResult);
- bool CheckForUpdate();
- bool CheckForUpdate(bool persistUpdateCheckResult);
- void CheckForUpdateAsync();
- void CheckForUpdateAsyncCancel();
- bool Update();
- void UpdateAsync();
- void UpdateAsyncCancel();
- void DownloadFileGroup(string groupName);
- void DownloadFileGroupAsync(string groupName);
- void DownloadFileGroupAsync(string groupName, object userState);
- bool IsFileGroupDownloaded(string groupName);
- void DownloadFileGroupAsyncCancel(string groupName);
- Version CurrentVersion { get; }
- Version UpdatedVersion { get; }
- string UpdatedApplicationFullName { get; }
- DateTime TimeOfLastUpdateCheck { get; }
- Uri UpdateLocation { get; }
- Uri ActivationUri { get; }
- string DataDirectory { get; }
- bool IsFirstRun { get; }
- //event DeploymentProgressChangedEventHandler CheckForUpdateProgressChanged;
- //event CheckForUpdateCompletedEventHandler CheckForUpdateCompleted;
- event DeploymentProgressChangedEventHandler UpdateProgressChanged;
- event AsyncCompletedEventHandler UpdateCompleted;
- //event DeploymentProgressChangedEventHandler DownloadFileGroupProgressChanged;
- //event DownloadFileGroupCompletedEventHandler DownloadFileGroupCompleted;
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/IDownloadTheLatestVersion.cs
@@ -1,7 +0,0 @@
-using gorilla.commons.utility;
-using Gorilla.Commons.Utility;
-
-namespace momoney.service.infrastructure.updating
-{
- public interface IDownloadTheLatestVersion : CallbackCommand<Percent> {}
-}
\ No newline at end of file
product/client/service.infrastructure/updating/IWhatIsTheAvailableVersion.cs
@@ -1,20 +0,0 @@
-using System;
-using gorilla.commons.utility;
-
-namespace momoney.service.infrastructure.updating
-{
- public interface IWhatIsTheAvailableVersion : Query<ApplicationVersion> {}
-
- public class ApplicationVersion
- {
- public Uri activation_url { get; set; }
- public Version current { get; set; }
- public string data_directory { get; set; }
- public bool updates_available { get; set; }
- public DateTime last_checked_for_updates { get; set; }
- public string application_name { get; set; }
- public Uri deployment_url { get; set; }
- public Version available_version { get; set; }
- public long size_of_update_in_bytes { get; set; }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/NullDeployment.cs
@@ -1,121 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Deployment.Application;
-using System.Threading;
-using MoMoney.Service.Infrastructure.Updating;
-
-namespace momoney.service.infrastructure.updating
-{
- public class NullDeployment : IDeployment
- {
- public UpdateCheckInfo CheckForDetailedUpdate()
- {
- Thread.Sleep(5000);
- return null;
- }
-
- public UpdateCheckInfo CheckForDetailedUpdate(bool persistUpdateCheckResult)
- {
- throw new NotImplementedException();
- }
-
- public bool CheckForUpdate()
- {
- return false;
- }
-
- public bool CheckForUpdate(bool persistUpdateCheckResult)
- {
- return false;
- }
-
- public void CheckForUpdateAsync()
- {
- }
-
- public void CheckForUpdateAsyncCancel()
- {
- }
-
- public bool Update()
- {
- return false;
- }
-
- public void UpdateAsync()
- {
- }
-
- public void UpdateAsyncCancel()
- {
- }
-
- public void DownloadFileGroup(string groupName)
- {
- }
-
- public void DownloadFileGroupAsync(string groupName)
- {
- }
-
- public void DownloadFileGroupAsync(string groupName, object userState)
- {
- }
-
- public bool IsFileGroupDownloaded(string groupName)
- {
- return false;
- }
-
- public void DownloadFileGroupAsyncCancel(string groupName)
- {
- }
-
- public Version CurrentVersion
- {
- get { throw new NotImplementedException(); }
- }
-
- public Version UpdatedVersion
- {
- get { throw new NotImplementedException(); }
- }
-
- public string UpdatedApplicationFullName
- {
- get { throw new NotImplementedException(); }
- }
-
- public DateTime TimeOfLastUpdateCheck
- {
- get { throw new NotImplementedException(); }
- }
-
- public Uri UpdateLocation
- {
- get { throw new NotImplementedException(); }
- }
-
- public Uri ActivationUri
- {
- get { throw new NotImplementedException(); }
- }
-
- public string DataDirectory
- {
- get { throw new NotImplementedException(); }
- }
-
- public bool IsFirstRun
- {
- get { throw new NotImplementedException(); }
- }
-
- //public event DeploymentProgressChangedEventHandler CheckForUpdateProgressChanged;
- //public event CheckForUpdateCompletedEventHandler CheckForUpdateCompleted;
- public event DeploymentProgressChangedEventHandler UpdateProgressChanged;
- public event AsyncCompletedEventHandler UpdateCompleted;
- //public event DeploymentProgressChangedEventHandler DownloadFileGroupProgressChanged;
- //public event DownloadFileGroupCompletedEventHandler DownloadFileGroupCompleted;
- }
-}
\ No newline at end of file
product/client/service.infrastructure/updating/WhatIsTheAvailableVersion.cs
@@ -1,35 +0,0 @@
-using momoney.service.infrastructure.updating;
-
-namespace MoMoney.Service.Infrastructure.Updating
-{
- public class WhatIsTheAvailableVersion : IWhatIsTheAvailableVersion
- {
- readonly IDeployment deployment;
-
- public WhatIsTheAvailableVersion(IDeployment deployment)
- {
- this.deployment = deployment;
- }
-
- public ApplicationVersion fetch()
- {
- var update = deployment.CheckForDetailedUpdate();
- if (null == update)
- {
- return new ApplicationVersion {updates_available = false,};
- }
- return new ApplicationVersion
- {
- activation_url = deployment.ActivationUri,
- current = deployment.CurrentVersion,
- data_directory = deployment.DataDirectory,
- updates_available = update.IsUpdateRequired || update.UpdateAvailable,
- last_checked_for_updates = deployment.TimeOfLastUpdateCheck,
- application_name = deployment.UpdatedApplicationFullName,
- deployment_url = deployment.UpdateLocation,
- available_version = update.AvailableVersion,
- size_of_update_in_bytes = update.UpdateSizeBytes,
- };
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/InfrastructureAssembly.cs
@@ -1,7 +0,0 @@
-namespace momoney.service.infrastructure
-{
- public class InfrastructureAssembly
- {
-
- }
-}
\ No newline at end of file
product/client/service.infrastructure/IProjectTasks.cs
@@ -1,11 +0,0 @@
-using Gorilla.Commons.Infrastructure.FileSystem;
-
-namespace momoney.service.infrastructure
-{
- public interface IProjectTasks
- {
- void open(File file);
- void copy_to(string path);
- void close(string path);
- }
-}
\ No newline at end of file
product/client/service.infrastructure/ProjectTasks.cs
@@ -1,31 +0,0 @@
-using Gorilla.Commons.Infrastructure.FileSystem;
-using momoney.database;
-using momoney.service.infrastructure;
-
-namespace MoMoney.Service.Infrastructure
-{
- public class ProjectTasks : IProjectTasks
- {
- readonly IDatabaseConfiguration configuration;
-
- public ProjectTasks(IDatabaseConfiguration configuration)
- {
- this.configuration = configuration;
- }
-
- public void open(File file)
- {
- configuration.open(file);
- }
-
- public void copy_to(string path)
- {
- configuration.copy_to(path);
- }
-
- public void close(string path)
- {
- configuration.close(path);
- }
- }
-}
\ No newline at end of file
product/client/service.infrastructure/service.infrastructure.csproj
@@ -72,53 +72,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="debugging\Launch.cs" />
- <Compile Include="eventing\SynchronizedEventAggregator.cs" />
- <Compile Include="eventing\IEvent.cs" />
- <Compile Include="eventing\EventAggregator.cs" />
- <Compile Include="eventing\EventSubscriber.cs" />
- <Compile Include="InfrastructureAssembly.cs" />
- <Compile Include="IProjectTasks.cs" />
- <Compile Include="logging\ILogFileTasks.cs" />
- <Compile Include="logging\LogFileTasks.cs" />
- <Compile Include="ProjectTasks.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="security\IsInRole.cs" />
- <Compile Include="security\Role.cs" />
- <Compile Include="threading\AsynchronousCommandProcessor.cs" />
- <Compile Include="threading\BackgroundThread.cs" />
- <Compile Include="threading\BackgroundThreadFactory.cs" />
- <Compile Include="threading\SynchronousCommandProcessor.cs" />
- <Compile Include="threading\CommandProcessor.cs" />
- <Compile Include="threading\IntervalTimer.cs" />
- <Compile Include="threading\ITimerClient.cs" />
- <Compile Include="threading\IWorkerThread.cs" />
- <Compile Include="threading\RaiseEventInterceptor.cs" />
- <Compile Include="threading\RunOnBackgroundThreadInterceptor.cs" />
- <Compile Include="threading\RunOnUIThread.cs" />
- <Compile Include="threading\SynchronizationContextFactory.cs" />
- <Compile Include="threading\SynchronizedCommand.cs" />
- <Compile Include="threading\SynchronizedContext.cs" />
- <Compile Include="threading\ThreadingExtensions.cs" />
- <Compile Include="threading\TimerFactory.cs" />
- <Compile Include="threading\WorkerThread.cs">
- <SubType>Component</SubType>
- </Compile>
- <Compile Include="threading\WorkItem.cs" />
- <Compile Include="transactions\EmptyUnitOfWork.cs" />
- <Compile Include="transactions\IUnitOfWork.cs" />
- <Compile Include="transactions\IUnitOfWorkFactory.cs" />
- <Compile Include="transactions\UnitOfWork.cs" />
- <Compile Include="transactions\UnitOfWorkFactory.cs" />
- <Compile Include="updating\CancelUpdate.cs" />
- <Compile Include="updating\CurrentDeployment.cs" />
- <Compile Include="updating\DownloadTheLatestVersion.cs" />
- <Compile Include="updating\ICancelUpdate.cs" />
- <Compile Include="updating\IDeployment.cs" />
- <Compile Include="updating\IDownloadTheLatestVersion.cs" />
- <Compile Include="updating\IWhatIsTheAvailableVersion.cs" />
- <Compile Include="updating\NullDeployment.cs" />
- <Compile Include="updating\WhatIsTheAvailableVersion.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\commons\infrastructure.thirdparty\infrastructure.thirdparty.csproj">
@@ -131,11 +85,7 @@
</ProjectReference>
<ProjectReference Include="..\..\commons\utility\utility.csproj">
<Project>{DD8FD29E-7424-415C-9BA3-7D9F6ECBA161}</Project>
- <Name>utility %28commons\utility%29</Name>
- </ProjectReference>
- <ProjectReference Include="..\database\database.csproj">
- <Project>{580E68A8-EDEE-4350-8BBE-A053645B0F83}</Project>
- <Name>database</Name>
+ <Name>utility</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -155,6 +105,10 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="eventing\" />
+ <Folder Include="threading\" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
product/client/service.infrastructure/threading/AsynchronousCommandProcessor.cs → product/commons/infrastructure/threading/AsynchronousCommandProcessor.cs
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using Gorilla.Commons.Infrastructure.Logging;
-using gorilla.commons.utility;
-
-namespace MoMoney.Service.Infrastructure.Threading
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using Gorilla.Commons.Infrastructure.Logging;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.threading
{
public class AsynchronousCommandProcessor : CommandProcessor
{
product/client/service.infrastructure/threading/BackgroundThread.cs → product/commons/infrastructure/threading/BackgroundThread.cs
@@ -1,6 +1,6 @@
-using gorilla.commons.Utility;
-
-namespace momoney.service.infrastructure.threading
+using gorilla.commons.Utility;
+
+namespace gorilla.commons.infrastructure.threading
{
public interface IBackgroundThread : DisposableCommand {}
product/client/service.infrastructure/threading/BackgroundThreadFactory.cs → product/commons/infrastructure/threading/BackgroundThreadFactory.cs
@@ -1,49 +1,49 @@
-using System;
-using Gorilla.Commons.Infrastructure.Container;
-using gorilla.commons.Utility;
-
-namespace momoney.service.infrastructure.threading
-{
- public interface IBackgroundThreadFactory
- {
- IBackgroundThread create_for<CommandToExecute>() where CommandToExecute : DisposableCommand;
- IBackgroundThread create_for(Action action);
- }
-
- public class BackgroundThreadFactory : IBackgroundThreadFactory
- {
- readonly DependencyRegistry registry;
-
- public BackgroundThreadFactory(DependencyRegistry registry)
- {
- this.registry = registry;
- }
-
- public IBackgroundThread create_for<CommandToExecute>() where CommandToExecute : DisposableCommand
- {
- return new BackgroundThread(registry.get_a<CommandToExecute>());
- }
-
- public IBackgroundThread create_for(Action action)
- {
- return new BackgroundThread(new AnonymousDisposableCommand(action));
- }
-
- class AnonymousDisposableCommand : DisposableCommand
- {
- readonly Action action;
-
- public AnonymousDisposableCommand(Action action)
- {
- this.action = action;
- }
-
- public void run()
- {
- action();
- }
-
- public void Dispose() {}
- }
- }
+using System;
+using Gorilla.Commons.Infrastructure.Container;
+using gorilla.commons.Utility;
+
+namespace gorilla.commons.infrastructure.threading
+{
+ public interface IBackgroundThreadFactory
+ {
+ IBackgroundThread create_for<CommandToExecute>() where CommandToExecute : DisposableCommand;
+ IBackgroundThread create_for(Action action);
+ }
+
+ public class BackgroundThreadFactory : IBackgroundThreadFactory
+ {
+ readonly DependencyRegistry registry;
+
+ public BackgroundThreadFactory(DependencyRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public IBackgroundThread create_for<CommandToExecute>() where CommandToExecute : DisposableCommand
+ {
+ return new BackgroundThread(registry.get_a<CommandToExecute>());
+ }
+
+ public IBackgroundThread create_for(Action action)
+ {
+ return new BackgroundThread(new AnonymousDisposableCommand(action));
+ }
+
+ class AnonymousDisposableCommand : DisposableCommand
+ {
+ readonly Action action;
+
+ public AnonymousDisposableCommand(Action action)
+ {
+ this.action = action;
+ }
+
+ public void run()
+ {
+ action();
+ }
+
+ public void Dispose() {}
+ }
+ }
}
\ No newline at end of file
product/client/service.infrastructure/threading/CommandProcessor.cs → product/commons/infrastructure/threading/CommandProcessor.cs
@@ -1,7 +1,7 @@
-using System;
-using gorilla.commons.utility;
-
-namespace MoMoney.Service.Infrastructure.Threading
+using System;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.threading
{
public interface CommandProcessor : Command
{
product/client/database/transactions/CurrentThread.cs → product/commons/infrastructure/threading/CurrentThread.cs
@@ -1,6 +1,6 @@
-using System.Threading;
-
-namespace momoney.database.transactions
+using System.Threading;
+
+namespace gorilla.commons.infrastructure.threading
{
public class CurrentThread : IThread
{
product/client/service.infrastructure/threading/IntervalTimer.cs → product/commons/infrastructure/threading/IntervalTimer.cs
@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Timers;
-using momoney.service.infrastructure.threading;
-namespace MoMoney.Service.Infrastructure.Threading
+namespace gorilla.commons.infrastructure.threading
{
public interface ITimer
{
product/client/database/transactions/IThread.cs → product/commons/infrastructure/threading/IThread.cs
@@ -1,4 +1,4 @@
-namespace momoney.database.transactions
+namespace gorilla.commons.infrastructure.threading
{
public interface IThread
{
product/client/service.infrastructure/threading/ITimerClient.cs → product/commons/infrastructure/threading/ITimerClient.cs
@@ -1,4 +1,4 @@
-namespace momoney.service.infrastructure.threading
+namespace gorilla.commons.infrastructure.threading
{
public interface ITimerClient
{
product/client/service.infrastructure/threading/IWorkerThread.cs → product/commons/infrastructure/threading/IWorkerThread.cs
@@ -1,7 +1,7 @@
-using System;
-using System.ComponentModel;
-
-namespace momoney.service.infrastructure.threading
+using System;
+using System.ComponentModel;
+
+namespace gorilla.commons.infrastructure.threading
{
public interface IWorkerThread : IDisposable
{
product/client/database/transactions/PerThread.cs → product/commons/infrastructure/threading/PerThread.cs
@@ -1,58 +1,59 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace momoney.database.transactions
-{
- public class PerThread : IContext
- {
- readonly IDictionary<int, LocalDataStoreSlot> slots;
- readonly object mutex = new object();
-
- public PerThread()
- {
- slots = new Dictionary<int, LocalDataStoreSlot>();
- }
-
- public bool contains<T>(IKey<T> key)
- {
- return key.is_found_in(get_items());
- }
-
- public void add<T>(IKey<T> key, T value)
- {
- key.add_value_to(get_items(), value);
- }
-
- public T value_for<T>(IKey<T> key)
- {
- return key.parse_from(get_items());
- }
-
- public void remove<T>(IKey<T> key)
- {
- key.remove_from(get_items());
- }
-
- IDictionary get_items()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- within_lock(() =>
- {
- if (!slots.ContainsKey(id))
- {
- var slot = Thread.GetNamedDataSlot(GetType().FullName);
- slots.Add(id, slot);
- Thread.SetData(slot, new Hashtable());
- }
- });
- return (IDictionary) Thread.GetData(slots[id]);
- }
-
- void within_lock(Action action)
- {
- lock (mutex) action();
- }
- }
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Threading;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.threading
+{
+ public class PerThread : IContext
+ {
+ readonly IDictionary<int, LocalDataStoreSlot> slots;
+ readonly object mutex = new object();
+
+ public PerThread()
+ {
+ slots = new Dictionary<int, LocalDataStoreSlot>();
+ }
+
+ public bool contains<T>(IKey<T> key)
+ {
+ return key.is_found_in(get_items());
+ }
+
+ public void add<T>(IKey<T> key, T value)
+ {
+ key.add_value_to(get_items(), value);
+ }
+
+ public T value_for<T>(IKey<T> key)
+ {
+ return key.parse_from(get_items());
+ }
+
+ public void remove<T>(IKey<T> key)
+ {
+ key.remove_from(get_items());
+ }
+
+ IDictionary get_items()
+ {
+ var id = Thread.CurrentThread.ManagedThreadId;
+ within_lock(() =>
+ {
+ if (!slots.ContainsKey(id))
+ {
+ var slot = Thread.GetNamedDataSlot(GetType().FullName);
+ slots.Add(id, slot);
+ Thread.SetData(slot, new Hashtable());
+ }
+ });
+ return (IDictionary) Thread.GetData(slots[id]);
+ }
+
+ void within_lock(Action action)
+ {
+ lock (mutex) action();
+ }
+ }
}
\ No newline at end of file
product/client/database/transactions/PerThreadScopedStorage.cs → product/commons/infrastructure/threading/PerThreadScopedStorage.cs
@@ -1,6 +1,7 @@
-using System.Collections;
-
-namespace momoney.database.transactions
+using System.Collections;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.threading
{
public class PerThreadScopedStorage : IScopedStorage
{
product/client/service.infrastructure/threading/SynchronizationContextFactory.cs → product/commons/infrastructure/threading/SynchronizationContextFactory.cs
@@ -1,8 +1,8 @@
-using System.Threading;
-using Gorilla.Commons.Infrastructure.Container;
-using gorilla.commons.utility;
-
-namespace momoney.service.infrastructure.threading
+using System.Threading;
+using Gorilla.Commons.Infrastructure.Container;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.threading
{
public interface ISynchronizationContextFactory : Factory<ISynchronizationContext> {}
product/client/service.infrastructure/threading/SynchronizedCommand.cs → product/commons/infrastructure/threading/SynchronizedCommand.cs
@@ -1,8 +1,8 @@
-using System;
-using System.Threading;
+using System;
+using System.Threading;
using gorilla.commons.utility;
-namespace momoney.service.infrastructure.threading
+namespace gorilla.commons.infrastructure.threading
{
public interface ISynchronizedCommand : Command<Action>, Command<Command> {}
product/client/service.infrastructure/threading/SynchronizedContext.cs → product/commons/infrastructure/threading/SynchronizedContext.cs
@@ -1,7 +1,7 @@
-using System.Threading;
+using System.Threading;
using gorilla.commons.utility;
-namespace momoney.service.infrastructure.threading
+namespace gorilla.commons.infrastructure.threading
{
public interface ISynchronizationContext : Command<Command> {}
product/client/service.infrastructure/threading/SynchronousCommandProcessor.cs → product/commons/infrastructure/threading/SynchronousCommandProcessor.cs
@@ -1,8 +1,8 @@
-using System;
-using System.Collections.Generic;
-using gorilla.commons.utility;
-
-namespace MoMoney.Service.Infrastructure.Threading
+using System;
+using System.Collections.Generic;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.threading
{
public class SynchronousCommandProcessor : CommandProcessor
{
product/client/service.infrastructure/threading/ThreadingExtensions.cs → product/commons/infrastructure/threading/ThreadingExtensions.cs
@@ -1,6 +1,6 @@
-using gorilla.commons.Utility;
-
-namespace momoney.service.infrastructure.threading
+using gorilla.commons.Utility;
+
+namespace gorilla.commons.infrastructure.threading
{
static public class ThreadingExtensions
{
product/client/service.infrastructure/threading/TimerFactory.cs → product/commons/infrastructure/threading/TimerFactory.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Timers;
-
-namespace momoney.service.infrastructure.threading
+using System;
+using System.Timers;
+
+namespace gorilla.commons.infrastructure.threading
{
public interface ITimerFactory
{
product/client/service.infrastructure/threading/WorkerThread.cs → product/commons/infrastructure/threading/WorkerThread.cs
@@ -1,8 +1,8 @@
-using System;
-using System.ComponentModel;
-using Gorilla.Commons.Infrastructure.Logging;
-
-namespace momoney.service.infrastructure.threading
+using System;
+using System.ComponentModel;
+using Gorilla.Commons.Infrastructure.Logging;
+
+namespace gorilla.commons.infrastructure.threading
{
public class WorkerThread : Component, IWorkerThread
{
product/commons/infrastructure/infrastructure.csproj
@@ -93,11 +93,31 @@
<Compile Include="reflection\EnvironmentExtensions.cs" />
<Compile Include="reflection\Assembly.cs" />
<Compile Include="registries\DefaultRegistry.cs" />
+ <Compile Include="threading\AsynchronousCommandProcessor.cs" />
+ <Compile Include="threading\BackgroundThread.cs" />
+ <Compile Include="threading\BackgroundThreadFactory.cs" />
+ <Compile Include="threading\CommandProcessor.cs" />
+ <Compile Include="threading\CurrentThread.cs" />
+ <Compile Include="threading\IntervalTimer.cs" />
+ <Compile Include="threading\IThread.cs" />
+ <Compile Include="threading\ITimerClient.cs" />
+ <Compile Include="threading\IWorkerThread.cs" />
+ <Compile Include="threading\PerThread.cs" />
+ <Compile Include="threading\PerThreadScopedStorage.cs" />
+ <Compile Include="threading\SynchronizationContextFactory.cs" />
+ <Compile Include="threading\SynchronizedCommand.cs" />
+ <Compile Include="threading\SynchronizedContext.cs" />
+ <Compile Include="threading\SynchronousCommandProcessor.cs" />
+ <Compile Include="threading\ThreadingExtensions.cs" />
+ <Compile Include="threading\TimerFactory.cs" />
+ <Compile Include="threading\WorkerThread.cs">
+ <SubType>Component</SubType>
+ </Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\utility\utility.csproj">
<Project>{DD8FD29E-7424-415C-9BA3-7D9F6ECBA161}</Project>
- <Name>utility %28commons\utility%29</Name>
+ <Name>utility</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
product/commons/infrastructure.thirdparty/infrastructure.thirdparty.csproj
@@ -130,7 +130,7 @@
</ProjectReference>
<ProjectReference Include="..\utility\utility.csproj">
<Project>{DD8FD29E-7424-415C-9BA3-7D9F6ECBA161}</Project>
- <Name>utility %28commons\utility%29</Name>
+ <Name>utility</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
product/client/database/transactions/Context.cs → product/commons/utility/Context.cs
@@ -1,34 +1,34 @@
-using System.Collections;
-
-namespace momoney.database.transactions
-{
- public class Context : IContext
- {
- readonly IDictionary items;
-
- public Context(IDictionary items)
- {
- this.items = items;
- }
-
- public bool contains<T>(IKey<T> key)
- {
- return key.is_found_in(items);
- }
-
- public void add<T>(IKey<T> key, T value)
- {
- key.add_value_to(items, value);
- }
-
- public T value_for<T>(IKey<T> key)
- {
- return key.parse_from(items);
- }
-
- public void remove<T>(IKey<T> key)
- {
- key.remove_from(items);
- }
- }
+using System.Collections;
+
+namespace gorilla.commons.utility
+{
+ public class Context : IContext
+ {
+ readonly IDictionary items;
+
+ public Context(IDictionary items)
+ {
+ this.items = items;
+ }
+
+ public bool contains<T>(IKey<T> key)
+ {
+ return key.is_found_in(items);
+ }
+
+ public void add<T>(IKey<T> key, T value)
+ {
+ key.add_value_to(items, value);
+ }
+
+ public T value_for<T>(IKey<T> key)
+ {
+ return key.parse_from(items);
+ }
+
+ public void remove<T>(IKey<T> key)
+ {
+ key.remove_from(items);
+ }
+ }
}
\ No newline at end of file
product/client/database/transactions/ContextFactory.cs → product/commons/utility/ContextFactory.cs
@@ -1,15 +1,10 @@
-namespace momoney.database.transactions
-{
- public interface IContextFactory
- {
- IContext create_for(IScopedStorage storage);
- }
-
- public class ContextFactory : IContextFactory
- {
- public IContext create_for(IScopedStorage storage)
- {
- return new Context(storage.provide_storage());
- }
- }
+namespace gorilla.commons.utility
+{
+ public class ContextFactory : IContextFactory
+ {
+ public IContext create_for(IScopedStorage storage)
+ {
+ return new Context(storage.provide_storage());
+ }
+ }
}
\ No newline at end of file
product/client/database/transactions/IContext.cs → product/commons/utility/IContext.cs
@@ -1,10 +1,10 @@
-namespace momoney.database.transactions
-{
- public interface IContext
- {
- bool contains<T>(IKey<T> key);
- void add<T>(IKey<T> key, T value);
- T value_for<T>(IKey<T> key);
- void remove<T>(IKey<T> key);
- }
+namespace gorilla.commons.utility
+{
+ public interface IContext
+ {
+ bool contains<T>(IKey<T> key);
+ void add<T>(IKey<T> key, T value);
+ T value_for<T>(IKey<T> key);
+ void remove<T>(IKey<T> key);
+ }
}
\ No newline at end of file
product/commons/utility/IContextFactory.cs
@@ -0,0 +1,7 @@
+namespace gorilla.commons.utility
+{
+ public interface IContextFactory
+ {
+ IContext create_for(IScopedStorage storage);
+ }
+}
\ No newline at end of file
product/client/database/transactions/IKey.cs → product/commons/utility/IKey.cs
@@ -1,6 +1,6 @@
-using System.Collections;
-
-namespace momoney.database.transactions
+using System.Collections;
+
+namespace gorilla.commons.utility
{
public interface IKey<T>
{
product/client/database/transactions/IScopedStorage.cs → product/commons/utility/IScopedStorage.cs
@@ -1,9 +1,9 @@
-using System.Collections;
-
-namespace momoney.database.transactions
-{
- public interface IScopedStorage
- {
- IDictionary provide_storage();
- }
+using System.Collections;
+
+namespace gorilla.commons.utility
+{
+ public interface IScopedStorage
+ {
+ IDictionary provide_storage();
+ }
}
\ No newline at end of file
product/client/database/transactions/SingletonScopedStorage.cs → product/commons/utility/SingletonScopedStorage.cs
@@ -1,14 +1,14 @@
-using System.Collections;
-
-namespace momoney.database.transactions
-{
- public class SingletonScopedStorage : IScopedStorage
- {
- static readonly IDictionary storage = new Hashtable();
-
- public IDictionary provide_storage()
- {
- return storage;
- }
- }
+using System.Collections;
+
+namespace gorilla.commons.utility
+{
+ public class SingletonScopedStorage : IScopedStorage
+ {
+ static readonly IDictionary storage = new Hashtable();
+
+ public IDictionary provide_storage()
+ {
+ return storage;
+ }
+ }
}
\ No newline at end of file
product/client/database/transactions/TypedKey.cs → product/commons/utility/TypedKey.cs
@@ -1,50 +1,50 @@
-using System.Collections;
-
-namespace momoney.database.transactions
-{
- public class TypedKey<T> : IKey<T>
- {
- public bool is_found_in(IDictionary items)
- {
- return items.Contains(create_key());
- }
-
- public T parse_from(IDictionary items)
- {
- return (T) items[create_key()];
- }
-
- public void remove_from(IDictionary items)
- {
- if (is_found_in(items)) items.Remove(create_key());
- }
-
- public void add_value_to(IDictionary items, T value)
- {
- items[create_key()] = value;
- }
-
- public bool Equals(TypedKey<T> obj)
- {
- return !ReferenceEquals(null, obj);
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (TypedKey<T>)) return false;
- return Equals((TypedKey<T>) obj);
- }
-
- public override int GetHashCode()
- {
- return GetType().GetHashCode();
- }
-
- string create_key()
- {
- return GetType().FullName;
- }
- }
+using System.Collections;
+
+namespace gorilla.commons.utility
+{
+ public class TypedKey<T> : IKey<T>
+ {
+ public bool is_found_in(IDictionary items)
+ {
+ return items.Contains(create_key());
+ }
+
+ public T parse_from(IDictionary items)
+ {
+ return (T) items[create_key()];
+ }
+
+ public void remove_from(IDictionary items)
+ {
+ if (is_found_in(items)) items.Remove(create_key());
+ }
+
+ public void add_value_to(IDictionary items, T value)
+ {
+ items[create_key()] = value;
+ }
+
+ public bool Equals(TypedKey<T> obj)
+ {
+ return !ReferenceEquals(null, obj);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != typeof (TypedKey<T>)) return false;
+ return Equals((TypedKey<T>) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return GetType().GetHashCode();
+ }
+
+ string create_key()
+ {
+ return GetType().FullName;
+ }
+ }
}
\ No newline at end of file
product/commons/utility/utility.csproj
@@ -77,6 +77,8 @@
<Compile Include="ChainedConfiguration.cs" />
<Compile Include="ChainedMapper.cs" />
<Compile Include="Command.cs" />
+ <Compile Include="Context.cs" />
+ <Compile Include="ContextFactory.cs" />
<Compile Include="EmptyCallback.cs" />
<Compile Include="EmptyCommand.cs" />
<Compile Include="DefaultConstructorFactory.cs" />
@@ -89,20 +91,26 @@
<Compile Include="CallbackCommand.cs" />
<Compile Include="Configuration.cs" />
<Compile Include="ComponentFactory.cs" />
+ <Compile Include="IContext.cs" />
+ <Compile Include="IContextFactory.cs" />
<Compile Include="Id.cs" />
<Compile Include="DisposableCommand.cs" />
<Compile Include="Factory.cs" />
<Compile Include="Identifiable.cs" />
+ <Compile Include="IKey.cs" />
<Compile Include="Import.cs" />
+ <Compile Include="IScopedStorage.cs" />
<Compile Include="Mapper.cs" />
<Compile Include="Notification.cs" />
<Compile Include="Observer.cs" />
<Compile Include="Parser.cs" />
<Compile Include="Query.cs" />
<Compile Include="Registry.cs" />
+ <Compile Include="SingletonScopedStorage.cs" />
<Compile Include="Specification.cs" />
<Compile Include="State.cs" />
<Compile Include="SubjectOf.cs" />
+ <Compile Include="TypedKey.cs" />
<Compile Include="ValueReturningVisitor.cs" />
<Compile Include="Visitable.cs" />
<Compile Include="Visitor.cs" />
product/presentation.windows.common/messages/AddedNewFamilyMember.cs
@@ -1,5 +1,4 @@
using System;
-using MoMoney.Service.Infrastructure.Eventing;
using ProtoBuf;
namespace presentation.windows.common.messages
product/presentation.windows.common/presentation.windows.common.csproj → product/presentation.windows.common/common.csproj
@@ -96,6 +96,7 @@
<Compile Include="AbstractHandler.cs" />
<Compile Include="DefaultMapper.cs" />
<Compile Include="Handler.cs" />
+ <Compile Include="IEvent.cs" />
<Compile Include="MessageHandler.cs" />
<Compile Include="messages\AddedNewFamilyMember.cs" />
<Compile Include="messages\CreateNewAccount.cs" />
product/presentation.windows.common/IEvent.cs
@@ -0,0 +1,6 @@
+namespace presentation.windows.common
+{
+ public interface IEvent
+ {
+ }
+}
\ No newline at end of file
product/presentation.windows.common/RhinoReceiver.cs
@@ -2,8 +2,8 @@ using System;
using System.Collections.Generic;
using System.Transactions;
using Gorilla.Commons.Infrastructure.Logging;
+using gorilla.commons.infrastructure.threading;
using gorilla.commons.utility;
-using MoMoney.Service.Infrastructure.Threading;
using Rhino.Queues;
using Rhino.Queues.Model;
product/presentation.windows.server/orm/nhibernate/NHibernateUnitOfWork.cs
@@ -1,5 +1,4 @@
-using momoney.database.transactions;
-using momoney.service.infrastructure.transactions;
+using gorilla.commons.utility;
using ISession = NHibernate.ISession;
using ITransaction = NHibernate.ITransaction;
@@ -30,7 +29,6 @@ namespace presentation.windows.server.orm.nhibernate
public void commit()
{
- //transaction.Commit();
if (is_dirty()) transaction.Commit();
}
product/presentation.windows.server/orm/nhibernate/NHibernateUnitOfWorkFactory.cs
@@ -1,6 +1,4 @@
-using momoney.database.transactions;
-using momoney.service.infrastructure.transactions;
-using MoMoney.Service.Infrastructure.Transactions;
+using gorilla.commons.utility;
using ISession = NHibernate.ISession;
using ISessionFactory = NHibernate.ISessionFactory;
product/client/service.infrastructure/transactions/EmptyUnitOfWork.cs → product/presentation.windows.server/orm/EmptyUnitOfWork.cs
@@ -1,22 +1,21 @@
-using Gorilla.Commons.Infrastructure.Logging;
-using momoney.service.infrastructure.transactions;
-
-namespace MoMoney.Service.Infrastructure.Transactions
-{
- public class EmptyUnitOfWork : IUnitOfWork
- {
- public void commit()
- {
- this.log().debug("committed empty unit of work");
- }
-
- public bool is_dirty()
- {
- return false;
- }
-
- public void Dispose()
- {
- }
- }
+using Gorilla.Commons.Infrastructure.Logging;
+
+namespace presentation.windows.server.orm
+{
+ public class EmptyUnitOfWork : IUnitOfWork
+ {
+ public void commit()
+ {
+ this.log().debug("committed empty unit of work");
+ }
+
+ public bool is_dirty()
+ {
+ return false;
+ }
+
+ public void Dispose()
+ {
+ }
+ }
}
\ No newline at end of file
product/client/service.infrastructure/transactions/IUnitOfWork.cs → product/presentation.windows.server/orm/IUnitOfWork.cs
@@ -1,6 +1,6 @@
-using System;
-
-namespace momoney.service.infrastructure.transactions
+using System;
+
+namespace presentation.windows.server.orm
{
public interface IUnitOfWork : IDisposable
{
product/client/service.infrastructure/transactions/IUnitOfWorkFactory.cs → product/presentation.windows.server/orm/IUnitOfWorkFactory.cs
@@ -1,6 +1,6 @@
using gorilla.commons.utility;
-namespace momoney.service.infrastructure.transactions
+namespace presentation.windows.server.orm
{
public interface IUnitOfWorkFactory : Factory<IUnitOfWork> {}
}
\ No newline at end of file
product/presentation.windows.server/Bootstrapper.cs
@@ -6,10 +6,8 @@ using Gorilla.Commons.Infrastructure.Container;
using Gorilla.Commons.Infrastructure.Logging;
using gorilla.commons.infrastructure.thirdparty.Autofac;
using gorilla.commons.infrastructure.thirdparty.Log4Net;
+using gorilla.commons.infrastructure.threading;
using gorilla.commons.utility;
-using momoney.database.transactions;
-using MoMoney.Service.Infrastructure.Threading;
-using momoney.service.infrastructure.transactions;
using presentation.windows.common;
using presentation.windows.server.handlers;
using presentation.windows.server.orm;
product/presentation.windows.server/Program.cs
@@ -1,14 +1,14 @@
using System;
using Gorilla.Commons.Infrastructure.Container;
using Gorilla.Commons.Infrastructure.Logging;
-using MoMoney.Service.Infrastructure.Threading;
+using gorilla.commons.infrastructure.threading;
using Rhino.Queues;
namespace presentation.windows.server
{
class Program
{
- static void Main(string[] args)
+ static void Main()
{
try
{
product/presentation.windows.server/presentation.windows.server.csproj → product/presentation.windows.server/server.csproj
@@ -134,6 +134,9 @@
<Compile Include="handlers\SaveNewAccountCommand.cs" />
<Compile Include="NHibernateBootstrapper.cs" />
<Compile Include="orm\AccountRepository.cs" />
+ <Compile Include="orm\EmptyUnitOfWork.cs" />
+ <Compile Include="orm\IUnitOfWork.cs" />
+ <Compile Include="orm\IUnitOfWorkFactory.cs" />
<Compile Include="orm\mappings\DateUserType.cs" />
<Compile Include="orm\mappings\MappingAssembly.cs" />
<Compile Include="orm\mappings\PersonMapping.cs" />
@@ -146,10 +149,6 @@
<Compile Include="StartServiceBus.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\client\database\database.csproj">
- <Project>{580E68A8-EDEE-4350-8BBE-A053645B0F83}</Project>
- <Name>database</Name>
- </ProjectReference>
<ProjectReference Include="..\client\service.infrastructure\service.infrastructure.csproj">
<Project>{81412692-F3EE-4FBF-A7C7-69454DD1BD46}</Project>
<Name>service.infrastructure</Name>
@@ -170,9 +169,9 @@
<Project>{DD8FD29E-7424-415C-9BA3-7D9F6ECBA161}</Project>
<Name>utility</Name>
</ProjectReference>
- <ProjectReference Include="..\presentation.windows.common\presentation.windows.common.csproj">
+ <ProjectReference Include="..\presentation.windows.common\common.csproj">
<Project>{72B22B1E-1B62-41A6-9392-BD5283D17F79}</Project>
- <Name>presentation.windows.common</Name>
+ <Name>common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
product/presentation.windows.server/StartServiceBus.cs
@@ -1,7 +1,7 @@
using Gorilla.Commons.Infrastructure.Container;
-using MoMoney.Service.Infrastructure.Threading;
-using momoney.service.infrastructure.transactions;
+using gorilla.commons.infrastructure.threading;
using presentation.windows.common;
+using presentation.windows.server.orm;
namespace presentation.windows.server
{
studio.sln
@@ -19,13 +19,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "infrastructure.thirdparty.l
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "utility", "product\commons\utility\utility.csproj", "{DD8FD29E-7424-415C-9BA3-7D9F6ECBA161}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "presentation.windows", "product\client\presentation.windows\presentation.windows.csproj", "{81E2CF6C-4D61-442E-8086-BF1E017C7041}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "client", "product\client\presentation.windows\client.csproj", "{81E2CF6C-4D61-442E-8086-BF1E017C7041}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "presentation.windows.server", "product\presentation.windows.server\presentation.windows.server.csproj", "{4E60988E-1A43-4807-8CEC-4E13F63DE363}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "server", "product\presentation.windows.server\server.csproj", "{4E60988E-1A43-4807-8CEC-4E13F63DE363}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "presentation.windows.common", "product\presentation.windows.common\presentation.windows.common.csproj", "{72B22B1E-1B62-41A6-9392-BD5283D17F79}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "database", "product\client\database\database.csproj", "{580E68A8-EDEE-4350-8BBE-A053645B0F83}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "common", "product\presentation.windows.common\common.csproj", "{72B22B1E-1B62-41A6-9392-BD5283D17F79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -68,10 +66,6 @@ Global
{72B22B1E-1B62-41A6-9392-BD5283D17F79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72B22B1E-1B62-41A6-9392-BD5283D17F79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72B22B1E-1B62-41A6-9392-BD5283D17F79}.Release|Any CPU.Build.0 = Release|Any CPU
- {580E68A8-EDEE-4350-8BBE-A053645B0F83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {580E68A8-EDEE-4350-8BBE-A053645B0F83}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {580E68A8-EDEE-4350-8BBE-A053645B0F83}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {580E68A8-EDEE-4350-8BBE-A053645B0F83}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -81,7 +75,6 @@ Global
{81E2CF6C-4D61-442E-8086-BF1E017C7041} = {07187CAA-7272-4E29-A736-5CBD5118D40B}
{4E60988E-1A43-4807-8CEC-4E13F63DE363} = {07187CAA-7272-4E29-A736-5CBD5118D40B}
{72B22B1E-1B62-41A6-9392-BD5283D17F79} = {07187CAA-7272-4E29-A736-5CBD5118D40B}
- {580E68A8-EDEE-4350-8BBE-A053645B0F83} = {07187CAA-7272-4E29-A736-5CBD5118D40B}
{AA5EEED9-4531-45F7-AFCD-AD9717D2E405} = {099D479D-7BFC-428E-A897-9189C294C9C8}
{04DC09B4-5DF9-44A6-8DD1-05941F0D0228} = {099D479D-7BFC-428E-A897-9189C294C9C8}
{6BDCB0C1-51E1-435A-93D8-CA02BF8E409C} = {099D479D-7BFC-428E-A897-9189C294C9C8}