├── .gitattributes ├── .gitignore ├── IDDD_Samples.sln ├── IDDD_Samples.sln.DotSettings ├── LICENSE.txt ├── README.txt ├── Settings.StyleCop ├── iddd_agilepm ├── AgilePM.csproj ├── Application │ ├── ApplicationServiceLifeCycle.cs │ ├── Notifications │ │ └── NotificationApplicationService.cs │ ├── Processes │ │ └── ProcessApplicationService.cs │ ├── Products │ │ ├── BacklogItems │ │ │ └── BacklogItemApplicationService.cs │ │ ├── InitiateDiscussionCommand.cs │ │ ├── NewProductCommand.cs │ │ ├── ProductApplicationService.cs │ │ ├── RequestProductDiscussionCommand.cs │ │ ├── RetryProductDiscussionRequestCommand.cs │ │ ├── StartDiscussionInitiationCommand.cs │ │ └── TimeOutProductDiscussionRequestCommand.cs │ ├── Sprints │ │ ├── CommitBacklogItemToSprintCommand.cs │ │ └── SprintApplicationService.cs │ └── Teams │ │ ├── ChangeTeamMemberEmailAddressCommand.cs │ │ ├── ChangeTeamMemberNameCommand.cs │ │ ├── DisableMemberCommand.cs │ │ ├── DisableProductOwnerCommand.cs │ │ ├── DisableTeamMemberCommand.cs │ │ ├── EnableMemberCommand.cs │ │ ├── EnableProductOwnerCommand.cs │ │ ├── EnableTeamMemberCommand.cs │ │ └── TeamApplicationService.cs ├── Domain.Model │ ├── Discussions │ │ ├── DiscussionAvailability.cs │ │ └── DiscussionDescriptor.cs │ ├── Products │ │ ├── BacklogItems │ │ │ ├── BacklogItem.cs │ │ │ ├── BacklogItemCategoryChanged.cs │ │ │ ├── BacklogItemCommitted.cs │ │ │ ├── BacklogItemDiscussion.cs │ │ │ ├── BacklogItemDiscussionInitiated.cs │ │ │ ├── BacklogItemDiscussionRequested.cs │ │ │ ├── BacklogItemId.cs │ │ │ ├── BacklogItemMarkedAsRemoved.cs │ │ │ ├── BacklogItemScheduled.cs │ │ │ ├── BacklogItemStatus.cs │ │ │ ├── BacklogItemStatusChanged.cs │ │ │ ├── BacklogItemStoryPointsAssigned.cs │ │ │ ├── BacklogItemStoryTold.cs │ │ │ ├── BacklogItemSummarized.cs │ │ │ ├── BacklogItemType.cs │ │ │ ├── BacklogItemTypeChanged.cs │ │ │ ├── BacklogItemUncommitted.cs │ │ │ ├── BacklogItemUnscheduled.cs │ │ │ ├── BusinessPriority.cs │ │ │ ├── BusinessPriorityAssigned.cs │ │ │ ├── BusinessPriorityRatings.cs │ │ │ ├── BusinessPriorityTotals.cs │ │ │ ├── EstimationLogEntry.cs │ │ │ ├── IBacklogItemRepository.cs │ │ │ ├── StoryPoints.cs │ │ │ ├── Task.cs │ │ │ ├── TaskDefined.cs │ │ │ ├── TaskDescribed.cs │ │ │ ├── TaskHoursRemainingEstimated.cs │ │ │ ├── TaskId.cs │ │ │ ├── TaskRemoved.cs │ │ │ ├── TaskRenamed.cs │ │ │ ├── TaskStatus.cs │ │ │ ├── TaskStatusChanged.cs │ │ │ └── TaskVolunteerAssigned.cs │ │ ├── IProductRepository.cs │ │ ├── Product.cs │ │ ├── ProductBacklogItem.cs │ │ ├── ProductBacklogItemPlanned.cs │ │ ├── ProductCreated.cs │ │ ├── ProductDiscussion.cs │ │ ├── ProductDiscussionInitiated.cs │ │ ├── ProductDiscussionRequestTimedOut.cs │ │ ├── ProductDiscussionRequested.cs │ │ ├── ProductId.cs │ │ ├── ProductReleaseScheduled.cs │ │ ├── ProductSprintScheduled.cs │ │ ├── Releases │ │ │ ├── IReleaseRepository.cs │ │ │ ├── Release.cs │ │ │ ├── ReleaseId.cs │ │ │ └── ScheduledBacklogItem.cs │ │ └── Sprints │ │ │ ├── CommittedBacklogItem.cs │ │ │ ├── ISprintRepository.cs │ │ │ ├── Sprint.cs │ │ │ └── SprintId.cs │ ├── Teams │ │ ├── IProductOwnerRepository.cs │ │ ├── ITeamMemberRepository.cs │ │ ├── ITeamRepository.cs │ │ ├── Member.cs │ │ ├── MemberChangeTracker.cs │ │ ├── ProductOwner.cs │ │ ├── ProductOwnerId.cs │ │ ├── Team.cs │ │ ├── TeamMember.cs │ │ └── TeamMemberId.cs │ └── Tenants │ │ └── TenantId.cs ├── IDDD.AgilePM.nuspec ├── Properties │ └── AssemblyInfo.cs ├── Settings.StyleCop └── packages.config ├── iddd_collaboration ├── Application │ ├── Calendars │ │ ├── CalendarApplicationService.cs │ │ ├── CalendarEntryApplicationService.cs │ │ ├── CalendarEntryQueryService.cs │ │ ├── CalendarQueryService.cs │ │ └── Data │ │ │ ├── CalendarData.cs │ │ │ ├── CalendarEntryData.cs │ │ │ ├── CalendarEntryInviteeData.cs │ │ │ ├── CalendarSharerData.cs │ │ │ └── ICalendarCommandResult.cs │ └── Forums │ │ ├── Data │ │ ├── DiscussionData.cs │ │ ├── DiscussionPostsData.cs │ │ ├── ForumData.cs │ │ ├── ForumDiscussionsData.cs │ │ ├── IDiscussionCommandResult.cs │ │ ├── IForumCommandResult.cs │ │ └── PostData.cs │ │ ├── DiscussionApplicationService.cs │ │ ├── DiscussionQueryService.cs │ │ ├── ForumApplicationService.cs │ │ ├── ForumQueryService.cs │ │ ├── PostApplicationService.cs │ │ └── PostQueryService.cs ├── Collaboration.csproj ├── Domain.Model │ ├── Calendars │ │ ├── Alarm.cs │ │ ├── AlarmUnitsType.cs │ │ ├── Calendar.cs │ │ ├── CalendarCreated.cs │ │ ├── CalendarDescriptionChanged.cs │ │ ├── CalendarEntry.cs │ │ ├── CalendarEntryDescriptionChanged.cs │ │ ├── CalendarEntryId.cs │ │ ├── CalendarEntryParticipantInvited.cs │ │ ├── CalendarEntryParticipantUninvited.cs │ │ ├── CalendarEntryRelocated.cs │ │ ├── CalendarEntryRescheduled.cs │ │ ├── CalendarEntryScheduled.cs │ │ ├── CalendarId.cs │ │ ├── CalendarIdentityService.cs │ │ ├── CalendarRenamed.cs │ │ ├── CalendarShared.cs │ │ ├── CalendarSharer.cs │ │ ├── CalendarUnshared.cs │ │ ├── DateRange.cs │ │ ├── ICalendarEntryRepository.cs │ │ ├── ICalendarRepository.cs │ │ ├── RepeatType.cs │ │ └── Repetition.cs │ ├── Collaborators │ │ ├── Author.cs │ │ ├── Collaborator .cs │ │ ├── Creator.cs │ │ ├── ICollaboratorService.cs │ │ ├── Moderator.cs │ │ ├── Owner.cs │ │ └── Participant.cs │ ├── Forums │ │ ├── Discussion.cs │ │ ├── DiscussionClosed.cs │ │ ├── DiscussionId.cs │ │ ├── DiscussionReopened.cs │ │ ├── DiscussionStarted.cs │ │ ├── Forum.cs │ │ ├── ForumClosed.cs │ │ ├── ForumDescriptionChanged.cs │ │ ├── ForumId.cs │ │ ├── ForumIdentityService.cs │ │ ├── ForumModeratorChanged.cs │ │ ├── ForumReopened.cs │ │ ├── ForumStarted.cs │ │ ├── ForumSubjectChanged.cs │ │ ├── IDiscussionRepository.cs │ │ ├── IForumRepository.cs │ │ ├── IPostRepository.cs │ │ ├── Post.cs │ │ ├── PostContentAltered.cs │ │ ├── PostId.cs │ │ └── PostedToDiscussion.cs │ └── Tenants │ │ └── Tenant.cs ├── IDDD.Collaboration.nuspec ├── Properties │ └── AssemblyInfo.cs ├── Settings.StyleCop └── packages.config ├── iddd_common ├── Common.csproj ├── Domain.Model │ ├── AssertionConcern.cs │ ├── DomainEventPublisher.cs │ ├── Entity.cs │ ├── EventSourcedRootEntity.cs │ ├── HashCodeHelper.cs │ ├── IDomainEvent.cs │ ├── IDomainEventSubscriber.cs │ ├── IIdentity.cs │ ├── Identity.cs │ ├── LongRunningProcess │ │ ├── IProcess.cs │ │ ├── ITimeConstrainedProcessTrackerRepository.cs │ │ ├── ProcessId.cs │ │ ├── ProcessTimedOut.cs │ │ └── TimeConstrainedProcessTracker.cs │ └── ValueObject.cs ├── Events │ ├── EventSerializer.cs │ ├── IEventStore.cs │ └── StoredEvent.cs ├── IDDD.Common.nuspec ├── Notifications │ ├── INotificationPublisher.cs │ ├── Notification.cs │ ├── NotificationLog.cs │ ├── NotificationLogFactory.cs │ ├── NotificationLogId.cs │ └── NotificationLogInfo.cs ├── Port.Adapters │ └── Persistence │ │ ├── AbstractQueryService.cs │ │ ├── JoinOn.cs │ │ └── ResultSetObjectMapper.cs ├── Properties │ └── AssemblyInfo.cs ├── Settings.StyleCop ├── packages.config └── packages.config.orig └── iddd_identityaccess ├── Application ├── AccessApplicationService.cs ├── Commands │ ├── ActivateTenantCommand.cs │ ├── AddGroupToGroupCommand.cs │ ├── AddUserToGroupCommand.cs │ ├── AssignUserToGroupCommand.cs │ ├── AssignUserToRoleCommand.cs │ ├── AuthenticateUserCommand.cs │ ├── ChangeContactInfoCommand.cs │ ├── ChangeEmailAddressCommand.cs │ ├── ChangePostalAddressCommand.cs │ ├── ChangePrimaryTelephoneCommand.cs │ ├── ChangeSecondaryTelephoneCommand.cs │ ├── ChangeUserPasswordCommand.cs │ ├── ChangeUserPersonalNameCommand.cs │ ├── DeactivateTenantCommand.cs │ ├── DefineUserEnablementCommand.cs │ ├── ProvisionGroupCommand.cs │ ├── ProvisionRoleCommand.cs │ ├── ProvisionTenantCommand.cs │ ├── RegisterUserCommand.cs │ ├── RemoveGroupFromGroupCommand.cs │ └── RemoveUserFromGroupCommand.cs ├── IdentityAccessEventProcessor.cs ├── IdentityApplicationService.cs └── NotificationApplicationService.cs ├── Domain.Model ├── Access │ ├── AuthorizationService.cs │ ├── GroupAssignedToRole.cs │ ├── GroupUnassignedFromRole.cs │ ├── IRoleRepository.cs │ ├── Role.cs │ ├── RoleProvisioned.cs │ ├── UserAssginedToRole.cs │ └── UserUnassignedFromRole.cs ├── DomainRegistry.cs ├── DomainServices.cd ├── EntitiesAndRepositories.cd └── Identity │ ├── AuthenticationService.cs │ ├── ContactInformation.cs │ ├── EmailAddress.cs │ ├── Enablement.cs │ ├── FullName.cs │ ├── Group.cs │ ├── GroupGroupAdded.cs │ ├── GroupGroupRemoved.cs │ ├── GroupMember.cs │ ├── GroupMemberService.cs │ ├── GroupMemberType.cs │ ├── GroupProvisioned.cs │ ├── GroupUserAdded.cs │ ├── GroupUserRemoved.cs │ ├── IEncryptionService.cs │ ├── IGroupRepository.cs │ ├── ITenantRepository.cs │ ├── IUserRepository.cs │ ├── InvitationDescriptor.cs │ ├── PasswordService.cs │ ├── Person.cs │ ├── PersonContactInformationChanged.cs │ ├── PersonNameChanged.cs │ ├── PostalAddress.cs │ ├── RegistrationInvitation.cs │ ├── Telephone.cs │ ├── Tenant.cs │ ├── TenantActivated.cs │ ├── TenantAdministratorRegistered.cs │ ├── TenantDeactivated.cs │ ├── TenantId.cs │ ├── TenantProvisioned.cs │ ├── TenantProvisioningService.cs │ ├── User.cs │ ├── UserDescriptor.cs │ ├── UserEnablementChanged.cs │ ├── UserPasswordChanged.cs │ └── UserRegistered.cs ├── IDDD.IdentityAccess.nuspec ├── IdentityAccess.csproj ├── Infrastructure └── Services │ └── MD5EncryptionService.cs ├── Properties └── AssemblyInfo.cs ├── Settings.StyleCop └── packages.config /LICENSE.txt: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | These are the sample Bounded Contexts for C#.NET from the book "Implementing Domain-Driven Design" by Vaughn Vernon: http://vaughnvernon.co/?page_id=168 2 | 3 | Java Samples: https://github.com/VaughnVernon/IDDD_Samples 4 | 5 | NOTE: These are currently an early work in progress. It's 6 | been pushed here so contributors can create pull requests, 7 | etc. 8 | 9 | Please don't complain unless you are willing to help ;) 10 | 11 | Vaughn -------------------------------------------------------------------------------- /iddd_agilepm/Application/ApplicationServiceLifeCycle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application 7 | { 8 | /// 9 | /// TODO: implement 10 | /// 11 | public class ApplicationServiceLifeCycle 12 | { 13 | public static void Begin(bool isListening = true) 14 | { 15 | 16 | } 17 | 18 | public static void Fail(Exception ex = null) 19 | { 20 | 21 | } 22 | 23 | public static void Success() 24 | { 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Notifications/NotificationApplicationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Notifications; 7 | 8 | namespace SaaSOvation.AgilePM.Application.Notifications 9 | { 10 | public class NotificationApplicationService 11 | { 12 | public NotificationApplicationService(INotificationPublisher notificationPublisher) 13 | { 14 | this.notificationPublisher = notificationPublisher; 15 | } 16 | 17 | readonly INotificationPublisher notificationPublisher; 18 | 19 | public void PublishNotifications() 20 | { 21 | ApplicationServiceLifeCycle.Begin(false); 22 | try 23 | { 24 | this.notificationPublisher.PublishNotifications(); 25 | ApplicationServiceLifeCycle.Success(); 26 | } 27 | catch (Exception ex) 28 | { 29 | ApplicationServiceLifeCycle.Fail(ex); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Processes/ProcessApplicationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model.LongRunningProcess; 7 | 8 | namespace SaaSOvation.AgilePM.Application.Processes 9 | { 10 | public class ProcessApplicationService 11 | { 12 | public ProcessApplicationService(ITimeConstrainedProcessTrackerRepository processTrackerRepository) 13 | { 14 | this.processTrackerRepository = processTrackerRepository; 15 | } 16 | 17 | readonly ITimeConstrainedProcessTrackerRepository processTrackerRepository; 18 | 19 | public void CheckForTimedOutProccesses() 20 | { 21 | ApplicationServiceLifeCycle.Begin(); 22 | try 23 | { 24 | var trackers = this.processTrackerRepository.GetAllTimedOut(); 25 | 26 | foreach (var tracker in trackers) 27 | { 28 | tracker.InformProcessTimedOut(); 29 | this.processTrackerRepository.Save(tracker); 30 | } 31 | 32 | ApplicationServiceLifeCycle.Success(); 33 | } 34 | catch (Exception ex) 35 | { 36 | ApplicationServiceLifeCycle.Fail(ex); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/BacklogItems/BacklogItemApplicationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems; 7 | 8 | namespace SaaSOvation.AgilePM.Application.Products.BacklogItems 9 | { 10 | public class BacklogItemApplicationService 11 | { 12 | public BacklogItemApplicationService(IBacklogItemRepository backlogItemRepository) 13 | { 14 | this.backlogItemRepository = backlogItemRepository; 15 | } 16 | 17 | readonly IBacklogItemRepository backlogItemRepository; 18 | 19 | // TODO: APIs for student assignment 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/InitiateDiscussionCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Products 7 | { 8 | public class InitiateDiscussionCommand 9 | { 10 | public InitiateDiscussionCommand() 11 | { 12 | } 13 | 14 | public InitiateDiscussionCommand(string tenantId, string discussionId, string productId) 15 | { 16 | this.TenantId = tenantId; 17 | this.DiscussionId = discussionId; 18 | this.ProductId = productId; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | 23 | public string DiscussionId { get; set; } 24 | 25 | public string ProductId { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/NewProductCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Products 7 | { 8 | public class NewProductCommand 9 | { 10 | public NewProductCommand() 11 | { 12 | } 13 | 14 | public NewProductCommand(string tenantId, string productOwnerId, string name, string description) 15 | { 16 | this.TenantId = tenantId; 17 | this.ProductOwnerId = productOwnerId; 18 | this.Name = name; 19 | this.Description = description; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | 24 | public string ProductOwnerId { get; set; } 25 | 26 | public string Name { get; set; } 27 | 28 | public string Description { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/RequestProductDiscussionCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Products 7 | { 8 | public class RequestProductDiscussionCommand 9 | { 10 | public RequestProductDiscussionCommand() 11 | { 12 | } 13 | 14 | public RequestProductDiscussionCommand(string tenantId, string productId) 15 | { 16 | this.TenantId = tenantId; 17 | this.ProductId = productId; 18 | } 19 | 20 | public string TenantId { get; set; } 21 | 22 | public string ProductId { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/RetryProductDiscussionRequestCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Products 7 | { 8 | public class RetryProductDiscussionRequestCommand 9 | { 10 | public RetryProductDiscussionRequestCommand() 11 | { 12 | } 13 | 14 | public RetryProductDiscussionRequestCommand(string tenantId, string processId) 15 | { 16 | this.TenantId = tenantId; 17 | this.ProcessId = processId; 18 | } 19 | 20 | public string TenantId { get; set; } 21 | 22 | public string ProcessId { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/StartDiscussionInitiationCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Products 7 | { 8 | public class StartDiscussionInitiationCommand 9 | { 10 | public StartDiscussionInitiationCommand() 11 | { 12 | } 13 | 14 | public StartDiscussionInitiationCommand(string tenantId, string productId) 15 | { 16 | this.TenantId = tenantId; 17 | this.ProductId = productId; 18 | } 19 | 20 | public string TenantId { get; set; } 21 | 22 | public string ProductId { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Products/TimeOutProductDiscussionRequestCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Products 7 | { 8 | public class TimeOutProductDiscussionRequestCommand 9 | { 10 | public TimeOutProductDiscussionRequestCommand() 11 | { 12 | } 13 | 14 | public TimeOutProductDiscussionRequestCommand(string tenantId, string processId, DateTime timeOutDate) 15 | { 16 | this.TenantId = tenantId; 17 | this.ProcessId = processId; 18 | this.TimeOutDate = timeOutDate; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | 23 | public string ProcessId { get; set; } 24 | 25 | public DateTime TimeOutDate { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Sprints/CommitBacklogItemToSprintCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Sprints 7 | { 8 | public class CommitBacklogItemToSprintCommand 9 | { 10 | public CommitBacklogItemToSprintCommand() 11 | { 12 | } 13 | 14 | public CommitBacklogItemToSprintCommand(string tenantId, string backlogItemId, string sprintId) 15 | { 16 | this.TenantId = tenantId; 17 | this.BacklogItemId = backlogItemId; 18 | this.SprintId = sprintId; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string BacklogItemId { get; set; } 23 | public string SprintId { get; set;} 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Sprints/SprintApplicationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems; 7 | using SaaSOvation.AgilePM.Domain.Model.Products.Sprints; 8 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 9 | 10 | namespace SaaSOvation.AgilePM.Application.Sprints 11 | { 12 | public class SprintApplicationService 13 | { 14 | public SprintApplicationService(ISprintRepository sprintRepository, IBacklogItemRepository backlogItemRepository) 15 | { 16 | this.sprintRepository = sprintRepository; 17 | this.backlogItemRepository = backlogItemRepository; 18 | } 19 | 20 | readonly ISprintRepository sprintRepository; 21 | readonly IBacklogItemRepository backlogItemRepository; 22 | 23 | public void CommitBacklogItemToSprint(CommitBacklogItemToSprintCommand command) 24 | { 25 | var tenantId = new TenantId(command.TenantId); 26 | var sprint = this.sprintRepository.Get(tenantId, new SprintId(command.SprintId)); 27 | var backlogItem = this.backlogItemRepository.Get(tenantId, new BacklogItemId(command.BacklogItemId)); 28 | 29 | sprint.Commit(backlogItem); 30 | 31 | this.sprintRepository.Save(sprint); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/ChangeTeamMemberEmailAddressCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class ChangeTeamMemberEmailAddressCommand 9 | { 10 | public ChangeTeamMemberEmailAddressCommand() 11 | { 12 | } 13 | 14 | public ChangeTeamMemberEmailAddressCommand(string tenantId, string username, string emailAddress, DateTime occurredOn) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = username; 18 | this.EmailAddress = emailAddress; 19 | this.OccurredOn = occurredOn; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string Username { get; set; } 24 | public string EmailAddress { get; set; } 25 | public DateTime OccurredOn { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/ChangeTeamMemberNameCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class ChangeTeamMemberNameCommand 9 | { 10 | public ChangeTeamMemberNameCommand() 11 | { 12 | } 13 | 14 | public ChangeTeamMemberNameCommand(string tenantId, string username, string firstName, string lastName, DateTime occurredOn) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = username; 18 | this.FirstName = firstName; 19 | this.LastName = lastName; 20 | this.OccurredOn = occurredOn; 21 | } 22 | 23 | public string TenantId { get; set; } 24 | public string Username { get; set; } 25 | public string FirstName { get; set; } 26 | public string LastName { get; set; } 27 | public DateTime OccurredOn { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/DisableMemberCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class DisableMemberCommand 9 | { 10 | public DisableMemberCommand() 11 | { 12 | } 13 | 14 | public DisableMemberCommand(string tenantId, string username, DateTime occurredOn) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = username; 18 | this.OccurredOn = occurredOn; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string Username { get; set; } 23 | public DateTime OccurredOn { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/DisableProductOwnerCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class DisableProductOwnerCommand : DisableMemberCommand 9 | { 10 | public DisableProductOwnerCommand() 11 | { 12 | } 13 | 14 | public DisableProductOwnerCommand(string tenantId, string username, DateTime occurredOn) 15 | : base(tenantId, username, occurredOn) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/DisableTeamMemberCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class DisableTeamMemberCommand : DisableMemberCommand 9 | { 10 | public DisableTeamMemberCommand() 11 | { 12 | } 13 | 14 | public DisableTeamMemberCommand(string tenantId, string username, DateTime occurredOn) 15 | : base(tenantId, username, occurredOn) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/EnableMemberCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class EnableMemberCommand 9 | { 10 | public EnableMemberCommand() 11 | { 12 | } 13 | 14 | public EnableMemberCommand(string tenantId, string username, string firstName, string lastName, string emailAddress, DateTime occurredOn) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = username; 18 | this.FirstName = firstName; 19 | this.LastName = lastName; 20 | this.EmailAddress = emailAddress; 21 | this.OccurredOn = occurredOn; 22 | } 23 | 24 | public string TenantId { get; set; } 25 | public string Username { get; set; } 26 | public string FirstName { get; set; } 27 | public string LastName { get; set; } 28 | public string EmailAddress { get; set; } 29 | public DateTime OccurredOn { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/EnableProductOwnerCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class EnableProductOwnerCommand : EnableMemberCommand 9 | { 10 | public EnableProductOwnerCommand() 11 | { 12 | } 13 | 14 | public EnableProductOwnerCommand(string tenantId, string username, string firstName, string lastName, string emailAddress, DateTime occurredOn) 15 | : base(tenantId, username, firstName, lastName, emailAddress, occurredOn) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_agilepm/Application/Teams/EnableTeamMemberCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Application.Teams 7 | { 8 | public class EnableTeamMemberCommand : EnableMemberCommand 9 | { 10 | public EnableTeamMemberCommand() 11 | { 12 | } 13 | 14 | public EnableTeamMemberCommand(string tenantId, string username, string firstName, string lastName, string emailAddress, DateTime occurredOn) 15 | : base(tenantId, username, firstName, lastName, emailAddress, occurredOn) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Discussions/DiscussionAvailability.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Discussions 16 | { 17 | public enum DiscussionAvailability 18 | { 19 | AddOnNotEnabled, 20 | Failed, 21 | NotRequested, 22 | Requested, 23 | Ready 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Discussions/DiscussionDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Discussions 16 | { 17 | public class DiscussionDescriptor : SaaSOvation.Common.Domain.Model.ValueObject 18 | { 19 | public const string UNDEFINED_ID = "UNDEFINED"; 20 | 21 | public DiscussionDescriptor(string id) 22 | { 23 | this.Id = id; 24 | } 25 | 26 | public DiscussionDescriptor(DiscussionDescriptor discussionDescriptor) 27 | : this(discussionDescriptor.Id) 28 | { 29 | } 30 | 31 | public string Id { get; private set; } 32 | 33 | public bool IsUndefined 34 | { 35 | get 36 | { 37 | return this.Id.Equals(UNDEFINED_ID); 38 | } 39 | } 40 | 41 | public override string ToString() 42 | { 43 | return "DiscussionDescriptor [id=" + Id + "]"; 44 | } 45 | 46 | protected override System.Collections.Generic.IEnumerable GetEqualityComponents() 47 | { 48 | yield return this.Id; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemCategoryChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemCategoryChanged : IDomainEvent 11 | { 12 | public BacklogItemCategoryChanged(Tenants.TenantId tenantId, BacklogItemId backlogItemId, string category) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.Category = category; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public string Category { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemCommitted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemCommitted : IDomainEvent 11 | { 12 | public BacklogItemCommitted(Tenants.TenantId tenantId, BacklogItemId backlogItemId, Sprints.SprintId sprintId) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.SprintId = sprintId; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public Sprints.SprintId SprintId { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemDiscussionInitiated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemDiscussionInitiated : IDomainEvent 11 | { 12 | public BacklogItemDiscussionInitiated(Tenants.TenantId tenantId, BacklogItemId backlogItemId, BacklogItemDiscussion discussion) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.Discussion = discussion; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public BacklogItemDiscussion Discussion { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemDiscussionRequested.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemDiscussionRequested : IDomainEvent 11 | { 12 | public BacklogItemDiscussionRequested(Tenants.TenantId tenantId, ProductId productId, BacklogItemId backlogItemId, bool isRequested) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.ProductId = productId; 18 | this.BacklogItemId = backlogItemId; 19 | this.IsRequested = isRequested; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public ProductId ProductId { get; private set; } 26 | public BacklogItemId BacklogItemId { get; private set; } 27 | 28 | public bool IsRequested { get; private set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 16 | { 17 | using SaaSOvation.Common.Domain.Model; 18 | 19 | public class BacklogItemId : Identity 20 | { 21 | public BacklogItemId() 22 | : base() 23 | { 24 | } 25 | 26 | public BacklogItemId(string id) 27 | : base(id) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemMarkedAsRemoved.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemMarkedAsRemoved : IDomainEvent 11 | { 12 | public BacklogItemMarkedAsRemoved(Tenants.TenantId tenantId, BacklogItemId backlogItemId) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | public BacklogItemId BacklogItemId { get; private set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemScheduled.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemScheduled : IDomainEvent 11 | { 12 | public BacklogItemScheduled(Tenants.TenantId tenantId, BacklogItemId backlogItemId, Releases.ReleaseId releaseId) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.ReleaseId = releaseId; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public Releases.ReleaseId ReleaseId { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 16 | { 17 | public enum BacklogItemStatus 18 | { 19 | Planned, 20 | Scheduled, 21 | Committed, 22 | Done, 23 | Removed 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemStatusChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemStatusChanged : IDomainEvent 11 | { 12 | public BacklogItemStatusChanged(Tenants.TenantId tenantId, BacklogItemId backlogItemId, BacklogItemStatus status) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.Status = status; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public BacklogItemStatus Status { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemStoryPointsAssigned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemStoryPointsAssigned : IDomainEvent 11 | { 12 | public BacklogItemStoryPointsAssigned(Tenants.TenantId tenantId, BacklogItemId backlogItemId, StoryPoints storyPoints) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | 18 | this.BacklogItemId = backlogItemId; 19 | this.StoryPoints = storyPoints; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | 26 | public BacklogItemId BacklogItemId { get; private set; } 27 | public StoryPoints StoryPoints { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemStoryTold.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemStoryTold : IDomainEvent 11 | { 12 | public BacklogItemStoryTold(Tenants.TenantId tenantId, BacklogItemId backlogItemId, string story) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | this.Story = story; 19 | } 20 | 21 | public Tenants.TenantId TenantId { get; private set; } 22 | public int EventVersion { get; set; } 23 | public DateTime OccurredOn { get; set; } 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | 26 | public string Story { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemSummarized.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemSummarized : IDomainEvent 11 | { 12 | public BacklogItemSummarized(Tenants.TenantId tenantId, BacklogItemId backlogItemId, string summary) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | this.Summary = summary; 19 | } 20 | 21 | public Tenants.TenantId TenantId { get; private set; } 22 | public int EventVersion { get; set; } 23 | public DateTime OccurredOn { get; set; } 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | 26 | public string Summary { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 16 | { 17 | public enum BacklogItemType 18 | { 19 | Feature, 20 | Enhancement, 21 | Defect, 22 | Foundation, 23 | Integration 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemTypeChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemTypeChanged : IDomainEvent 11 | { 12 | public BacklogItemTypeChanged(Tenants.TenantId tenantId, BacklogItemId backlogItemId, BacklogItemType type) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.BacklogItemType = type; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public BacklogItemType BacklogItemType { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemUncommitted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemUncommitted : IDomainEvent 11 | { 12 | public BacklogItemUncommitted(Tenants.TenantId tenantId, BacklogItemId backlogItemId, Sprints.SprintId sprintId) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.SprintId = sprintId; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public Sprints.SprintId SprintId { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BacklogItemUnscheduled.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BacklogItemUnscheduled : IDomainEvent 11 | { 12 | public BacklogItemUnscheduled(Tenants.TenantId tenantId, BacklogItemId backlogItemId, Releases.ReleaseId unscheduledReleaseId) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.UnscheduledReleaseId = unscheduledReleaseId; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | public BacklogItemId BacklogItemId { get; private set; } 26 | 27 | public Releases.ReleaseId UnscheduledReleaseId { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BusinessPriority.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BusinessPriority : ValueObject 11 | { 12 | public BusinessPriority(BusinessPriorityRatings ratings) 13 | { 14 | AssertionConcern.AssertArgumentNotNull(ratings, "The ratings must be provided."); 15 | this.Ratings = ratings; 16 | } 17 | 18 | public BusinessPriorityRatings Ratings { get; private set; } 19 | 20 | public float CostPercentage(BusinessPriorityTotals totals) 21 | { 22 | return (float)100 * this.Ratings.Cost / totals.TotalCost; 23 | } 24 | 25 | public float Priority(BusinessPriorityTotals totals) 26 | { 27 | var costAndRisk = CostPercentage(totals) + RiskPercentage(totals); 28 | return ValuePercentage(totals) / costAndRisk; 29 | } 30 | 31 | public float RiskPercentage(BusinessPriorityTotals totals) 32 | { 33 | return (float)100 * this.Ratings.Risk / totals.TotalRisk; 34 | } 35 | 36 | public float ValuePercentage(BusinessPriorityTotals totals) 37 | { 38 | return (float)100 * this.TotalValue / totals.TotalValue; 39 | } 40 | 41 | public float TotalValue 42 | { 43 | get 44 | { 45 | return this.Ratings.Benefit + this.Ratings.Penalty; 46 | } 47 | } 48 | 49 | protected override IEnumerable GetEqualityComponents() 50 | { 51 | yield return this.Ratings; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BusinessPriorityAssigned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BusinessPriorityAssigned : IDomainEvent 11 | { 12 | public BusinessPriorityAssigned(Tenants.TenantId tenantId, BacklogItemId backlogItemId, BusinessPriority businessPriority) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | 18 | this.BacklogItemId = backlogItemId; 19 | this.BusinessPriority = businessPriority; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | public int EventVersion { get; set; } 24 | public DateTime OccurredOn { get; set; } 25 | 26 | public BacklogItemId BacklogItemId { get; private set; } 27 | public BusinessPriority BusinessPriority { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/BusinessPriorityTotals.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class BusinessPriorityTotals : ValueObject 11 | { 12 | public BusinessPriorityTotals(int totalBenefit, int totalPenalty, int totalValue, int totalCost, int totalRisk) 13 | { 14 | this.TotalBenefit = totalBenefit; 15 | this.TotalPenalty = totalPenalty; 16 | this.TotalValue = totalValue; 17 | this.TotalCost = totalCost; 18 | this.TotalRisk = totalRisk; 19 | } 20 | 21 | public int TotalBenefit { get; private set; } 22 | public int TotalPenalty { get; private set; } 23 | public int TotalValue { get; private set; } 24 | public int TotalCost { get; private set; } 25 | public int TotalRisk { get; private set; } 26 | 27 | protected override IEnumerable GetEqualityComponents() 28 | { 29 | yield return this.TotalBenefit; 30 | yield return this.TotalPenalty; 31 | yield return this.TotalValue; 32 | yield return this.TotalCost; 33 | yield return this.TotalRisk; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/IBacklogItemRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 7 | using SaaSOvation.AgilePM.Domain.Model.Products.Sprints; 8 | using SaaSOvation.AgilePM.Domain.Model.Products.Releases; 9 | 10 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 11 | { 12 | public interface IBacklogItemRepository 13 | { 14 | ICollection GetAllComittedTo(TenantId tenantId, SprintId sprintId); 15 | 16 | ICollection GetAllScheduledFor(TenantId tenantId, ReleaseId releaseId); 17 | 18 | ICollection GetAllOutstanding(TenantId tenantId, ProductId productId); 19 | 20 | ICollection GetAll(TenantId tenantId, ProductId productId); 21 | 22 | BacklogItem Get(TenantId tenantId, BacklogItemId backlogItemId); 23 | 24 | BacklogItemId GetNextIdentity(); 25 | 26 | void Remove(BacklogItem backlogItem); 27 | 28 | void RemoveAll(IEnumerable backlogItems); 29 | 30 | void Save(BacklogItem backlogItem); 31 | 32 | void SaveAll(IEnumerable backlogItems); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/StoryPoints.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 16 | { 17 | using System; 18 | 19 | public enum StoryPoints 20 | { 21 | Zero, 22 | One, 23 | Two, 24 | Three, 25 | Five, 26 | Eight, 27 | Thirteen, 28 | Twenty, 29 | Forty, 30 | OneHundred 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskDefined.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskDefined : IDomainEvent 11 | { 12 | public TaskDefined(Tenants.TenantId tenantId, BacklogItemId backlogItemId, TaskId taskId, string volunteerMemberId, string name, string description) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | 19 | this.TaskId = taskId; 20 | this.VolunteerMemberId = volunteerMemberId; 21 | this.Name = name; 22 | this.Description = description; 23 | } 24 | 25 | public Tenants.TenantId TenantId { get; private set; } 26 | public int EventVersion { get; set; } 27 | public DateTime OccurredOn { get; set; } 28 | public BacklogItemId BacklogItemId { get; private set; } 29 | 30 | public TaskId TaskId { get; private set; } 31 | public string VolunteerMemberId { get; private set; } 32 | public string Description { get; private set; } 33 | public string Name { get; private set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskDescribed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskDescribed : IDomainEvent 11 | { 12 | public TaskDescribed(Tenants.TenantId tenantId, BacklogItemId backlogItemId, TaskId taskId, string description) 13 | { 14 | this.TenantId = tenantId; 15 | this.BacklogItemId = backlogItemId; 16 | this.TaskId = taskId; 17 | this.Description = description; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | public TaskId TaskId { get; private set; } 26 | public string Description { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskHoursRemainingEstimated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskHoursRemainingEstimated : IDomainEvent 11 | { 12 | public TaskHoursRemainingEstimated(Tenants.TenantId tenantId, BacklogItemId backlogItemId, TaskId taskId, int hoursRemaining) 13 | { 14 | this.TenantId = tenantId; 15 | this.BacklogItemId = backlogItemId; 16 | this.TaskId = taskId; 17 | this.HoursRemaining = hoursRemaining; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | public TaskId TaskId { get; private set; } 26 | public int HoursRemaining { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskId : ValueObject 11 | { 12 | public TaskId() 13 | : this(Guid.NewGuid().ToString().ToUpper().Substring(0, 8)) 14 | { 15 | } 16 | 17 | public TaskId(string id) 18 | { 19 | AssertionConcern.AssertArgumentNotEmpty(id, "The id must be provided."); 20 | AssertionConcern.AssertArgumentLength(id, 8, "The id must be 8 characters or less."); 21 | this.Id = id; 22 | } 23 | 24 | public string Id { get; private set; } 25 | 26 | protected override IEnumerable GetEqualityComponents() 27 | { 28 | yield return this.Id; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskRemoved.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskRemoved : IDomainEvent 11 | { 12 | public TaskRemoved(Tenants.TenantId tenantId, BacklogItemId backlogItemId) 13 | { 14 | this.TenantId = tenantId; 15 | this.EventVersion = 1; 16 | this.OccurredOn = DateTime.UtcNow; 17 | this.BacklogItemId = backlogItemId; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | public BacklogItemId BacklogItemId { get; private set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskRenamed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskRenamed : IDomainEvent 11 | { 12 | public TaskRenamed(Tenants.TenantId tenantId, BacklogItemId backlogItemId, TaskId taskId, string name) 13 | { 14 | this.TenantId = tenantId; 15 | this.BacklogItemId = backlogItemId; 16 | this.TaskId = taskId; 17 | this.Name = name; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | public TaskId TaskId { get; private set; } 26 | public string Name { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 7 | { 8 | public enum TaskStatus 9 | { 10 | NotStarted, 11 | InProgress, 12 | Impeded, 13 | Done 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskStatusChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskStatusChanged : IDomainEvent 11 | { 12 | public TaskStatusChanged(Tenants.TenantId tenantId, BacklogItemId backlogItemId, TaskId taskId, TaskStatus status) 13 | { 14 | this.TenantId = tenantId; 15 | this.BacklogItemId = backlogItemId; 16 | this.TaskId = taskId; 17 | this.Status = status; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | public TaskId TaskId { get; private set; } 26 | public TaskStatus Status { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/BacklogItems/TaskVolunteerAssigned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products.BacklogItems 9 | { 10 | public class TaskVolunteerAssigned : IDomainEvent 11 | { 12 | public TaskVolunteerAssigned(Tenants.TenantId tenantId, BacklogItemId backlogItemId, TaskId taskId, string volunteerMemberId) 13 | { 14 | this.TenantId = tenantId; 15 | this.BacklogItemId = backlogItemId; 16 | this.TaskId = taskId; 17 | this.VolunteerMemberId = volunteerMemberId; 18 | } 19 | 20 | public Tenants.TenantId TenantId { get; private set; } 21 | public int EventVersion { get; set; } 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public BacklogItemId BacklogItemId { get; private set; } 25 | public TaskId TaskId { get; private set; } 26 | public string VolunteerMemberId { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/IProductRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Domain.Model.Products 7 | { 8 | public interface IProductRepository 9 | { 10 | ICollection GetAllByTenant(Tenants.TenantId tenantId); 11 | 12 | ProductId GetNextIdentity(); 13 | 14 | Product GetByDiscussionInitiationId(Tenants.TenantId tenantId, string discussionInitiationId); 15 | 16 | Product Get(Tenants.TenantId tenantId, Products.ProductId productId); 17 | 18 | void Remove(Product product); 19 | 20 | void RemoveAll(IEnumerable products); 21 | 22 | void Save(Product product); 23 | 24 | void SaveAll(IEnumerable products); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/ProductDiscussionInitiated.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products 16 | { 17 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 18 | using SaaSOvation.Common.Domain.Model; 19 | using System; 20 | 21 | public class ProductDiscussionInitiated : IDomainEvent 22 | { 23 | public ProductDiscussionInitiated(TenantId tenantId, ProductId productId, ProductDiscussion productDiscussion) 24 | { 25 | this.EventVersion = 1; 26 | this.OccurredOn = DateTime.Now; 27 | this.ProductDiscussion = productDiscussion; 28 | this.ProductId = productId; 29 | this.TenantId = tenantId; 30 | } 31 | 32 | public int EventVersion { get; set; } 33 | 34 | public DateTime OccurredOn { get; set; } 35 | 36 | public ProductDiscussion ProductDiscussion { get; private set; } 37 | 38 | public ProductId ProductId { get; private set; } 39 | 40 | public TenantId TenantId { get; private set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/ProductDiscussionRequestTimedOut.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model.LongRunningProcess; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Products 9 | { 10 | public class ProductDiscussionRequestTimedOut : ProcessTimedOut 11 | { 12 | public ProductDiscussionRequestTimedOut(string tenantId, ProcessId processId, int totalRetriedPermitted, int retryCount) 13 | : base(tenantId, processId, totalRetriedPermitted, retryCount) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/ProductId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products 16 | { 17 | using SaaSOvation.Common.Domain.Model; 18 | 19 | public class ProductId : Identity 20 | { 21 | public ProductId() 22 | : base() 23 | { 24 | } 25 | 26 | public ProductId(string id) 27 | : base(id) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/Releases/IReleaseRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | 20 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 21 | 22 | namespace SaaSOvation.AgilePM.Domain.Model.Products.Releases 23 | { 24 | public interface IReleaseRepository 25 | { 26 | ICollection GetAllProductReleases(TenantId tenantId, ProductId productId); 27 | 28 | ReleaseId GetNextIdentity(); 29 | 30 | Release Get(TenantId tenantId, ReleaseId releaseId); 31 | 32 | void Remove(Release release); 33 | 34 | void RemoveAll(IEnumerable releases); 35 | 36 | void Save(Release release); 37 | 38 | void SaveAll(IEnumerable releases); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/Releases/ReleaseId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products.Releases 16 | { 17 | using SaaSOvation.Common.Domain.Model; 18 | 19 | public class ReleaseId : Identity 20 | { 21 | public ReleaseId() 22 | : base() 23 | { 24 | } 25 | 26 | public ReleaseId(string id) 27 | : base(id) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/Sprints/ISprintRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Text; 19 | 20 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 21 | 22 | namespace SaaSOvation.AgilePM.Domain.Model.Products.Sprints 23 | { 24 | public interface ISprintRepository 25 | { 26 | Sprint Get(TenantId tenantId, SprintId sprintId); 27 | 28 | ICollection GetAllProductSprints(TenantId tenantId, ProductId productId); 29 | 30 | SprintId GetNextIdentity(); 31 | 32 | void Remove(Sprint sprint); 33 | 34 | void RemoveAll(IEnumerable sprints); 35 | 36 | void Save(Sprint sprint); 37 | 38 | void SaveAll(IEnumerable sprints); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Products/Sprints/SprintId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Products.Sprints 16 | { 17 | using SaaSOvation.Common.Domain.Model; 18 | 19 | public class SprintId : Identity 20 | { 21 | public SprintId() 22 | : base() 23 | { 24 | } 25 | 26 | public SprintId(string id) 27 | : base(id) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Teams/IProductOwnerRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Teams 9 | { 10 | public interface IProductOwnerRepository 11 | { 12 | ICollection GetAllProductOwners(TenantId tenantId); 13 | 14 | ProductOwner Get(TenantId tenantId, string userName); 15 | 16 | void Remove(ProductOwner owner); 17 | 18 | void RemoveAll(IEnumerable owners); 19 | 20 | void Save(ProductOwner owner); 21 | 22 | void SaveAll(IEnumerable owners); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Teams/ITeamMemberRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Domain.Model.Teams 7 | { 8 | public interface ITeamMemberRepository 9 | { 10 | ICollection GetAllTeamMembers(Tenants.TenantId tenantId); 11 | 12 | void Remove(TeamMember teamMember); 13 | 14 | void RemoveAll(IEnumerable teamMembers); 15 | 16 | void Save(TeamMember teamMember); 17 | 18 | void SaveAll(IEnumerable teamMembers); 19 | 20 | TeamMember Get(Tenants.TenantId tenantId, string userName); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Teams/ITeamRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.AgilePM.Domain.Model.Teams 7 | { 8 | public interface ITeamRepository 9 | { 10 | ICollection GetAllTeams(Tenants.TenantId tenantId); 11 | 12 | void Remove(Team team); 13 | 14 | void RemoveAll(IEnumerable teams); 15 | 16 | void Save(Team team); 17 | 18 | void SaveAll(IEnumerable teams); 19 | 20 | Team GetByName(Tenants.TenantId tenantId, string name); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Teams/ProductOwnerId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Teams 16 | { 17 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 18 | using SaaSOvation.Common.Domain.Model; 19 | 20 | public class ProductOwnerId : Identity 21 | { 22 | public ProductOwnerId(TenantId tenantId, string id) 23 | : base(tenantId + ":" + id) 24 | { 25 | } 26 | 27 | public TenantId TenantId 28 | { 29 | get 30 | { 31 | return new TenantId(this.Id.Split(':')[0]); 32 | } 33 | } 34 | 35 | public string Identity 36 | { 37 | get 38 | { 39 | return this.Id.Split(':')[1]; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Teams/TeamMember.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.AgilePM.Domain.Model.Tenants; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Teams 9 | { 10 | public class TeamMember : Member 11 | { 12 | public TeamMember(TenantId tenantId, string userName, string firstName, string lastName, string emailAddress, DateTime initializedOn) 13 | : base(tenantId, userName, firstName, lastName, emailAddress, initializedOn) 14 | { 15 | } 16 | 17 | public TeamMemberId TeamMemberId 18 | { 19 | get 20 | { 21 | // TODO: consider length restrictions on TeamMemberId.Id 22 | return new TeamMemberId(this.TenantId, this.Username); 23 | } 24 | } 25 | 26 | protected override IEnumerable GetIdentityComponents() 27 | { 28 | yield return this.TenantId; 29 | yield return this.Username; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Teams/TeamMemberId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.AgilePM.Domain.Model.Teams 9 | { 10 | public class TeamMemberId : ValueObject 11 | { 12 | public TeamMemberId(Tenants.TenantId tenantId, string id) 13 | { 14 | AssertionConcern.AssertArgumentNotNull(tenantId, "The tenantId must be provided."); 15 | AssertionConcern.AssertArgumentNotEmpty(id, "The id must be provided."); 16 | AssertionConcern.AssertArgumentLength(id, 36, "The id must be 36 characters or less."); 17 | 18 | this.TenantId = tenantId; 19 | this.Id = id; 20 | } 21 | 22 | public Tenants.TenantId TenantId { get; private set; } 23 | 24 | public string Id { get; private set; } 25 | 26 | protected override IEnumerable GetEqualityComponents() 27 | { 28 | yield return this.TenantId; 29 | yield return this.Id; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iddd_agilepm/Domain.Model/Tenants/TenantId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.AgilePM.Domain.Model.Tenants 16 | { 17 | using SaaSOvation.Common.Domain.Model; 18 | 19 | public class TenantId : Identity 20 | { 21 | public TenantId() 22 | : base() 23 | { 24 | } 25 | 26 | public TenantId(string id) 27 | : base(id) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_agilepm/IDDD.AgilePM.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IDDD.AgilePM 5 | 1.0.0 6 | IDDD.AgilePM 7 | Vaughn Vernon 8 | Vaughn Vernon 9 | false 10 | Sample "Agile Project Management" Bounded Context from the book "Implementing Domain-Driven Design" by Vaughn Vernon 11 | 12 | Copyright © 2012,2013 Vaughn Vernon 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /iddd_agilepm/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("SaaSOvation.AgilePM")] 10 | [assembly: AssemblyDescription("Sample \"Agile Project Management\" Bounded Context from the book \"Implementing Domain-Driven Design\" by Vaughn Vernon")] 11 | [assembly: AssemblyCompany("SaaSOvation")] 12 | [assembly: AssemblyProduct("Agile Project Management")] 13 | [assembly: AssemblyCopyright("Copyright © 2012,2013 Vaughn Vernon")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: CLSCompliant(true)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // Synchronize these with the values in the nuspec file. 26 | [assembly: AssemblyVersion("1.0.0.0")] 27 | [assembly: AssemblyFileVersion("1.0.0.0")] 28 | 29 | // Setting ComVisible to false makes the types in this assembly not visible 30 | // to COM components. If you need to access a type in this assembly from 31 | // COM, set the ComVisible attribute to true on that type. 32 | [assembly: ComVisible(false)] 33 | 34 | // The following GUID is for the ID of the typelib if this project is exposed to COM 35 | [assembly: Guid("8f0fef08-4c5d-45ef-90c2-6e61f30927f0")] 36 | 37 | // For unit tests 38 | [assembly: InternalsVisibleTo("SaaSOvation.AgilePM.Tests")] 39 | -------------------------------------------------------------------------------- /iddd_agilepm/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | ..\Settings.StyleCop 4 | Linked 5 | 6 | -------------------------------------------------------------------------------- /iddd_agilepm/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Calendars/Data/CalendarData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Calendars.Data 7 | { 8 | public class CalendarData 9 | { 10 | public string CalendarId { get; set; } 11 | public string Description { get; set; } 12 | public string Name { get; set; } 13 | public string OwnerEmailAddress { get; set; } 14 | public string OwnerIdentity { get; set; } 15 | public string OwnerName { get; set; } 16 | public ISet Sharers { get; set; } 17 | public string TenantId { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Calendars/Data/CalendarEntryData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Calendars.Data 7 | { 8 | public class CalendarEntryData 9 | { 10 | public int AlarmAlarmUnits { get; set; } 11 | public string AlarmAlarmUnitsType { get; set; } 12 | public string CalendarEntryId { get; set; } 13 | public string CalendarId { get; set; } 14 | public string Description { get; set; } 15 | public ISet Invitees { get; set; } 16 | public string Location { get; set; } 17 | public string OwnerEmailAddress { get; set; } 18 | public string OwnerIdentity { get; set; } 19 | public string OwnerName { get; set; } 20 | public DateTime RepetitionEnds { get; set; } 21 | public string RepetitionType { get; set; } 22 | public string TenantId { get; set; } 23 | public DateTime TimeSpanBegins { get; set; } 24 | public DateTime TimeSpanEnds { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Calendars/Data/CalendarEntryInviteeData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Calendars.Data 7 | { 8 | public class CalendarEntryInviteeData 9 | { 10 | public string CalendarEntryId { get; set; } 11 | public string ParticipantEmailAddress { get; set; } 12 | public string ParticipantIdentity { get; set; } 13 | public string ParticipantName { get; set; } 14 | public string TenantId { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Calendars/Data/CalendarSharerData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Calendars.Data 7 | { 8 | public class CalendarSharerData 9 | { 10 | public string CalendarId { get; set; } 11 | public string ParticipantEmailAddress { get; set; } 12 | public string ParticipantIdentity { get; set; } 13 | public string ParticipantName { get; set; } 14 | public string TenantId { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Calendars/Data/ICalendarCommandResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Calendars.Data 7 | { 8 | public interface ICalendarCommandResult 9 | { 10 | void SetResultingCalendarId(string calendarId); 11 | 12 | void SetResultingCalendarEntryId(string calendarEntryId); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/DiscussionData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public class DiscussionData 9 | { 10 | public string AuthorEmailAddress{ get; set; } 11 | public string AuthorIdentity{ get; set; } 12 | public string AuthorName{ get; set; } 13 | public bool Closed{ get; set; } 14 | public string DiscussionId{ get; set; } 15 | public string ExclusiveOwner{ get; set; } 16 | public string ForumId{ get; set; } 17 | public string Subject{ get; set; } 18 | public string TenantId{ get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/DiscussionPostsData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public class DiscussionPostsData 9 | { 10 | public string AuthorEmailAddress { get; set; } 11 | public string AuthorIdentity { get; set; } 12 | public string AuthorName { get; set; } 13 | public bool Closed { get; set; } 14 | public string DiscussionId { get; set; } 15 | public string ExclusiveOwner { get; set; } 16 | public string ForumId { get; set; } 17 | public ISet Posts { get; set; } 18 | public string Subject { get; set; } 19 | public string TenantId { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/ForumData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public class ForumData 9 | { 10 | public bool Closed { get; set; } 11 | public string CreatorEmailAddress { get; set; } 12 | public string CreatorIdentity { get; set; } 13 | public string CreatorName { get; set; } 14 | public string Description { get; set; } 15 | public string ExclusiveOwner { get; set; } 16 | public string ForumId { get; set; } 17 | public string ModeratorEmailAddress { get; set; } 18 | public string ModeratorIdentity { get; set; } 19 | public string ModeratorName { get; set; } 20 | public string Subject { get; set; } 21 | public string TenantId { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/ForumDiscussionsData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public class ForumDiscussionsData 9 | { 10 | public bool Closed { get; set; } 11 | public string CreatorEmailAddress { get; set; } 12 | public string CreatorIdentity { get; set; } 13 | public string CreatorName { get; set; } 14 | public string Description { get; set; } 15 | public string ExclusiveOwner { get; set; } 16 | public ISet Discussions { get; set; } 17 | public string ForumId { get; set; } 18 | public string ModeratorEmailAddress { get; set; } 19 | public string ModeratorIdentity { get; set; } 20 | public string ModeratorName { get; set; } 21 | public string Subject { get; set; } 22 | public string TenantId { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/IDiscussionCommandResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public interface IDiscussionCommandResult 9 | { 10 | void SetResultingDiscussionId(string discussionId); 11 | 12 | void SetResultingPostId(string postId); 13 | 14 | void SetRresultingInReplyToPostId(string replyToPostId); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/IForumCommandResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public interface IForumCommandResult 9 | { 10 | void SetResultingForumId(string forumId); 11 | 12 | void SetResultingDiscussionId(string discussionId); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/Data/PostData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Application.Forums.Data 7 | { 8 | public class PostData 9 | { 10 | public string AuthorEmailAddress { get; set; } 11 | public string AuthorIdentity { get; set; } 12 | public string AuthorName { get; set; } 13 | public string BodyText { get; set; } 14 | public DateTime ChangedOn { get; set; } 15 | public DateTime CreatedOn { get; set; } 16 | public string DiscussionId { get; set; } 17 | public string ForumId { get; set; } 18 | public string PostId { get; set; } 19 | public string ReplyToPostId { get; set; } 20 | public string Subject { get; set; } 21 | public string TenantId { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/PostApplicationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Collaboration.Domain.Model.Forums; 7 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 8 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 9 | using SaaSOvation.Collaboration.Application.Forums.Data; 10 | 11 | namespace SaaSOvation.Collaboration.Application.Forums 12 | { 13 | public class PostApplicationService 14 | { 15 | public PostApplicationService(IPostRepository postRepository, IForumRepository forumRepository, ICollaboratorService collaboratorService) 16 | { 17 | this.postRepository = postRepository; 18 | this.forumRepository = forumRepository; 19 | this.collaboratorService = collaboratorService; 20 | } 21 | 22 | readonly IPostRepository postRepository; 23 | readonly IForumRepository forumRepository; 24 | readonly ICollaboratorService collaboratorService; 25 | 26 | public void ModeratePost( 27 | string tenantId, 28 | string forumId, 29 | string postId, 30 | string moderatorId, 31 | string subject, 32 | string bodyText) 33 | { 34 | var tenant = new Tenant(tenantId); 35 | 36 | var forum = this.forumRepository.Get(tenant, new ForumId(forumId)); 37 | 38 | var moderator = this.collaboratorService.GetModeratorFrom(tenant, moderatorId); 39 | 40 | var post = this.postRepository.Get(tenant, new PostId(postId)); 41 | 42 | forum.ModeratePost(post, moderator, subject, bodyText); 43 | 44 | this.postRepository.Save(post); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /iddd_collaboration/Application/Forums/PostQueryService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Port.Adapters.Persistence; 7 | using SaaSOvation.Collaboration.Application.Forums.Data; 8 | 9 | namespace SaaSOvation.Collaboration.Application.Forums 10 | { 11 | public class PostQueryService : AbstractQueryService 12 | { 13 | public PostQueryService(string connectionString, string providerName) 14 | : base(connectionString, providerName) 15 | { 16 | } 17 | 18 | public IList GetAllPostsDataByDiscussion(string tenantId, string discussionId) 19 | { 20 | return QueryObjects( 21 | "select * from tbl_vw_post where tenant_id = ? and discussion_id = ?", 22 | new JoinOn(), 23 | tenantId, 24 | discussionId); 25 | } 26 | 27 | public PostData GetPostDataById(string tenantId, string postId) 28 | { 29 | return QueryObject( 30 | "select * from tbl_vw_post where tenant_id = ? and post_id = ?", 31 | new JoinOn(), 32 | tenantId, 33 | postId); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/Alarm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 9 | { 10 | public class Alarm : ValueObject 11 | { 12 | public Alarm(AlarmUnitsType alarmUnitsType, int alarmUnits) 13 | { 14 | this.alarmUnitsType = alarmUnitsType; 15 | this.alarmUnits = alarmUnits; 16 | } 17 | 18 | readonly int alarmUnits; 19 | readonly AlarmUnitsType alarmUnitsType; 20 | 21 | public AlarmUnitsType AlarmUnitsType 22 | { 23 | get { return this.alarmUnitsType; } 24 | } 25 | 26 | public int AlarmUnits 27 | { 28 | get { return this.alarmUnits; } 29 | } 30 | 31 | protected override IEnumerable GetEqualityComponents() 32 | { 33 | yield return this.alarmUnits; 34 | yield return this.alarmUnitsType; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/AlarmUnitsType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public enum AlarmUnitsType 9 | { 10 | Days, 11 | Hours, 12 | Minutes 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarCreated : IDomainEvent 13 | { 14 | public CalendarCreated(Tenant tenant, CalendarId calendarId, string name, string description, Owner owner, IEnumerable sharedWith) 15 | { 16 | this.Tenant = tenant; 17 | this.CalendarId = calendarId; 18 | this.Name = name; 19 | this.Description = description; 20 | this.Owner = owner; 21 | this.SharedWith = sharedWith; 22 | } 23 | 24 | public Tenant Tenant { get; private set; } 25 | 26 | public CalendarId CalendarId { get; private set; } 27 | 28 | public string Name { get; private set; } 29 | 30 | public string Description { get; private set; } 31 | 32 | public Owner Owner { get; private set; } 33 | 34 | public IEnumerable SharedWith { get; private set; } 35 | 36 | public int EventVersion { get; set; } 37 | public DateTime OccurredOn { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarDescriptionChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarDescriptionChanged : IDomainEvent 13 | { 14 | public CalendarDescriptionChanged(Tenant tenant, CalendarId calendarId, string name, string description) 15 | { 16 | this.Tenant = tenant; 17 | this.CalendarId = calendarId; 18 | this.Name = name; 19 | this.Description = description; 20 | } 21 | 22 | public Tenant Tenant { get; private set; } 23 | 24 | public CalendarId CalendarId { get; private set; } 25 | 26 | public string Name { get; private set; } 27 | 28 | public string Description { get; private set; } 29 | 30 | 31 | public int EventVersion { get; set; } 32 | 33 | public DateTime OccurredOn { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarEntryDescriptionChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarEntryDescriptionChanged : IDomainEvent 13 | { 14 | public CalendarEntryDescriptionChanged( 15 | Tenant tenant, 16 | CalendarId calendarId, 17 | CalendarEntryId calendarEntryId, 18 | string description) 19 | { 20 | this.Tenant = tenant; 21 | this.CalendarId = calendarId; 22 | this.CalendarEntryId = calendarEntryId; 23 | this.Description = description; 24 | } 25 | 26 | public Tenant Tenant { get; private set; } 27 | public CalendarId CalendarId { get; private set; } 28 | public CalendarEntryId CalendarEntryId { get; private set; } 29 | public string Description { get; private set; } 30 | 31 | public int EventVersion { get; set; } 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarEntryId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public class CalendarEntryId : SaaSOvation.Common.Domain.Model.Identity 9 | { 10 | public CalendarEntryId() 11 | { 12 | } 13 | 14 | public CalendarEntryId(string id) 15 | : base(id) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarEntryParticipantInvited.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarEntryParticipantInvited : IDomainEvent 13 | { 14 | public CalendarEntryParticipantInvited( 15 | Tenant tenant, 16 | CalendarId calendarId, 17 | CalendarEntryId calendarEntryId, 18 | Participant participant) 19 | { 20 | this.Tenant = tenant; 21 | this.CalendarId = calendarId; 22 | this.CalendarEntryId = calendarEntryId; 23 | this.Participant = participant; 24 | } 25 | 26 | public Tenant Tenant { get; private set; } 27 | public CalendarId CalendarId { get; private set; } 28 | public CalendarEntryId CalendarEntryId { get; private set; } 29 | public Participant Participant { get; private set; } 30 | 31 | public int EventVersion { get; set; } 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarEntryParticipantUninvited.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarEntryParticipantUninvited : IDomainEvent 13 | { 14 | public CalendarEntryParticipantUninvited( 15 | Tenant tenant, 16 | CalendarId calendarId, 17 | CalendarEntryId calendarEntryId, 18 | Participant participant) 19 | { 20 | this.Tenant = tenant; 21 | this.CalendarId = calendarId; 22 | this.CalendarEntryId = calendarEntryId; 23 | this.Participant = participant; 24 | } 25 | 26 | public Tenant Tenant { get; private set; } 27 | public CalendarId CalendarId { get; private set; } 28 | public CalendarEntryId CalendarEntryId { get; private set; } 29 | public Participant Participant { get; private set; } 30 | 31 | public int EventVersion { get; set; } 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarEntryRelocated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarEntryRelocated : IDomainEvent 13 | { 14 | public CalendarEntryRelocated( 15 | Tenant tenant, 16 | CalendarId calendarId, 17 | CalendarEntryId calendarEntryId, 18 | string location) 19 | { 20 | this.Tenant = tenant; 21 | this.CalendarId = calendarId; 22 | this.CalendarEntryId = calendarEntryId; 23 | this.Location = location; 24 | } 25 | 26 | public Tenant Tenant { get; private set; } 27 | public CalendarId CalendarId { get; private set; } 28 | public CalendarEntryId CalendarEntryId { get; private set; } 29 | public string Location { get; private set; } 30 | 31 | public int EventVersion { get; set; } 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarEntryRescheduled.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarEntryRescheduled : IDomainEvent 13 | { 14 | public CalendarEntryRescheduled( 15 | Tenant tenant, 16 | CalendarId calendarId, 17 | CalendarEntryId calendarEntryId, 18 | DateRange timeSpan, 19 | Repetition repetition, 20 | Alarm alarm) 21 | { 22 | this.Tenant = tenant; 23 | this.CalendarId = calendarId; 24 | this.CalendarEntryId = calendarEntryId; 25 | this.TimeSpan = timeSpan; 26 | this.Repetition = repetition; 27 | this.Alarm = alarm; 28 | } 29 | 30 | public Tenant Tenant { get; private set; } 31 | public CalendarId CalendarId { get; private set; } 32 | public CalendarEntryId CalendarEntryId { get; private set; } 33 | public DateRange TimeSpan { get; private set; } 34 | public Repetition Repetition { get; private set; } 35 | public Alarm Alarm { get; private set; } 36 | 37 | public int EventVersion { get; set; } 38 | public DateTime OccurredOn { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public class CalendarId : SaaSOvation.Common.Domain.Model.Identity 9 | { 10 | public CalendarId() { } 11 | 12 | public CalendarId(string id) 13 | : base(id) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarIdentityService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public class CalendarIdentityService 9 | { 10 | public CalendarIdentityService(ICalendarRepository calendarRepository, ICalendarEntryRepository calendarEntryRepository) 11 | { 12 | this.calendarRepository = calendarRepository; 13 | this.calendarEntryRepository = calendarEntryRepository; 14 | } 15 | 16 | readonly ICalendarRepository calendarRepository; 17 | readonly ICalendarEntryRepository calendarEntryRepository; 18 | 19 | public CalendarId GetNextCalendarId() 20 | { 21 | return this.calendarRepository.GetNextIdentity(); 22 | } 23 | 24 | public CalendarEntryId GetNextCalendarEntryId() 25 | { 26 | return this.calendarEntryRepository.GetNextIdentity(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarRenamed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarRenamed : IDomainEvent 13 | { 14 | public CalendarRenamed(Tenant tenant, CalendarId calendarId, string name, string description) 15 | { 16 | this.Tenant = tenant; 17 | this.CalendarId = calendarId; 18 | this.Name = name; 19 | this.Description = description; 20 | } 21 | 22 | public Tenant Tenant { get; private set; } 23 | 24 | public CalendarId CalendarId { get; private set; } 25 | 26 | public string Name { get; private set; } 27 | 28 | public string Description { get; private set; } 29 | 30 | public int EventVersion { get; set; } 31 | 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarShared.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarShared : IDomainEvent 13 | { 14 | public CalendarShared(Tenant tenant, CalendarId calendarId, string name, CalendarSharer sharedWith) 15 | { 16 | this.Tenant = tenant; 17 | this.CalendarId = calendarId; 18 | this.Name = name; 19 | this.SharedWith = sharedWith; 20 | } 21 | 22 | public Tenant Tenant { get; private set; } 23 | public CalendarId CalendarId { get; private set; } 24 | public string Name { get; private set; } 25 | public CalendarSharer SharedWith { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarSharer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 8 | 9 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 10 | { 11 | public class CalendarSharer : ValueObject, IComparable 12 | { 13 | public CalendarSharer(Participant participant) 14 | { 15 | AssertionConcern.AssertArgumentNotNull(participant, "Participant must be provided."); 16 | this.participant = participant; 17 | } 18 | 19 | readonly Participant participant; 20 | 21 | protected override IEnumerable GetEqualityComponents() 22 | { 23 | yield return this.participant; 24 | } 25 | 26 | public int CompareTo(CalendarSharer other) 27 | { 28 | return this.participant.CompareTo(other.participant); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/CalendarUnshared.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 11 | { 12 | public class CalendarUnshared : IDomainEvent 13 | { 14 | public CalendarUnshared(Tenant tenant, CalendarId calendarId, string name, CalendarSharer unsharedWith) 15 | { 16 | this.Tenant = tenant; 17 | this.CalendarId = calendarId; 18 | this.Name = name; 19 | this.UnsharedWith = unsharedWith; 20 | } 21 | 22 | public Tenant Tenant { get; private set; } 23 | public CalendarId CalendarId { get; private set; } 24 | public string Name { get; private set; } 25 | public CalendarSharer UnsharedWith { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/DateRange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 9 | { 10 | public class DateRange : ValueObject 11 | { 12 | public DateRange(DateTime begins, DateTime ends) 13 | { 14 | if (begins > ends) 15 | throw new ArgumentException("Time span must not end before it begins."); 16 | 17 | this.begins = begins; 18 | this.ends = ends; 19 | } 20 | 21 | readonly DateTime begins; 22 | readonly DateTime ends; 23 | 24 | public DateTime Begins 25 | { 26 | get { return this.begins; } 27 | } 28 | 29 | public DateTime Ends 30 | { 31 | get { return this.ends; } 32 | } 33 | 34 | protected override IEnumerable GetEqualityComponents() 35 | { 36 | yield return this.begins; 37 | yield return this.ends; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/ICalendarEntryRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public interface ICalendarEntryRepository 9 | { 10 | CalendarEntry Get(Tenants.Tenant tenant, CalendarEntryId calendarId); 11 | CalendarEntryId GetNextIdentity(); 12 | void Save(CalendarEntry calendarEntry); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/ICalendarRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public interface ICalendarRepository 9 | { 10 | Calendar Get(Tenants.Tenant tenant, CalendarId calendarId); 11 | CalendarId GetNextIdentity(); 12 | void Save(Calendar calendar); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/RepeatType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 7 | { 8 | public enum RepeatType 9 | { 10 | DoesNotRepeat, 11 | Daily, 12 | Weekly, 13 | Monthly, 14 | Yearly 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Calendars/Repetition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.Collaboration.Domain.Model.Calendars 9 | { 10 | public class Repetition : ValueObject 11 | { 12 | public static Repetition DoesNotRepeat(DateTime ends) 13 | { 14 | return new Repetition(RepeatType.DoesNotRepeat, ends); 15 | } 16 | 17 | public static Repetition RepeatsIndefinitely(RepeatType repeatType) 18 | { 19 | return new Repetition(repeatType, DateTime.MaxValue); 20 | } 21 | 22 | public Repetition(RepeatType repeats, DateTime ends) 23 | { 24 | this.Repeats = repeats; 25 | this.Ends = ends; 26 | } 27 | 28 | public RepeatType Repeats { get; private set; } 29 | 30 | public DateTime Ends { get; private set; } 31 | 32 | protected override IEnumerable GetEqualityComponents() 33 | { 34 | yield return this.Repeats; 35 | yield return this.Ends; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Collaborators/Author.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Collaborators 16 | { 17 | public sealed class Author : Collaborator 18 | { 19 | public Author(string identity, string name, string emailAddress) 20 | : base(identity, name, emailAddress) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Collaborators/Creator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Collaborators 16 | { 17 | public sealed class Creator : Collaborator 18 | { 19 | public Creator(string identity, string name, string emailAddress) 20 | : base(identity, name, emailAddress) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Collaborators/ICollaboratorService.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Collaborators 16 | { 17 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 18 | 19 | public interface ICollaboratorService 20 | { 21 | Author GetAuthorFrom(Tenant tenant, string identity); 22 | 23 | Creator GetCreatorFrom(Tenant tenant, string identity); 24 | 25 | Moderator GetModeratorFrom(Tenant tenant, string identity); 26 | 27 | Owner GetOwnerFrom(Tenant enant, string identity); 28 | 29 | Participant GetParticipantFrom(Tenant tenant, string identity); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Collaborators/Moderator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Collaborators 16 | { 17 | public sealed class Moderator : Collaborator 18 | { 19 | public Moderator(string identity, string name, string emailAddress) 20 | : base(identity, name, emailAddress) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Collaborators/Owner.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Collaborators 16 | { 17 | public sealed class Owner : Collaborator 18 | { 19 | public Owner(string identity, string name, string emailAddress) 20 | : base(identity, name, emailAddress) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Collaborators/Participant.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Collaborators 16 | { 17 | public sealed class Participant : Collaborator 18 | { 19 | public Participant(string identity, string name, string emailAddress) 20 | : base(identity, name, emailAddress) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/DiscussionClosed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class DiscussionClosed : IDomainEvent 13 | { 14 | public DiscussionClosed(Tenant tenantId, ForumId forumId, DiscussionId discussionId, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.DiscussionId = discussionId; 19 | this.ExclusiveOwner = exclusiveOwner; 20 | } 21 | 22 | public Tenant TenantId { get; private set; } 23 | public ForumId ForumId { get; private set; } 24 | public DiscussionId DiscussionId { get; private set; } 25 | public string ExclusiveOwner { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/DiscussionId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public class DiscussionId : SaaSOvation.Common.Domain.Model.Identity 9 | { 10 | public DiscussionId(string id) 11 | : base(id) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/DiscussionReopened.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class DiscussionReopened : IDomainEvent 13 | { 14 | public DiscussionReopened(Tenant tenantId, ForumId forumId, DiscussionId discussionId, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.DiscussionId = discussionId; 19 | this.ExclusiveOwner = exclusiveOwner; 20 | } 21 | 22 | public Tenant TenantId { get; private set; } 23 | public ForumId ForumId { get; private set; } 24 | public DiscussionId DiscussionId { get; private set; } 25 | public string ExclusiveOwner { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/DiscussionStarted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class DiscussionStarted : IDomainEvent 13 | { 14 | public DiscussionStarted(Tenant tenantId, ForumId forumId, DiscussionId discussionId, Author author, string subject, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.DiscussionId = discussionId; 19 | this.Author = author; 20 | this.Subject = subject; 21 | this.ExclusiveOwner = exclusiveOwner; 22 | } 23 | 24 | public Tenant TenantId { get; private set; } 25 | public ForumId ForumId { get; private set; } 26 | public DiscussionId DiscussionId { get; private set; } 27 | public Author Author { get; private set; } 28 | public string Subject { get; private set; } 29 | public string ExclusiveOwner { get; private set; } 30 | 31 | public int EventVersion { get; set; } 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumClosed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class ForumClosed : IDomainEvent 13 | { 14 | public ForumClosed(Tenant tenantId, ForumId forumId, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.ExclusiveOwner = exclusiveOwner; 19 | } 20 | 21 | public Tenant TenantId { get; private set; } 22 | public ForumId ForumId { get; private set; } 23 | public string ExclusiveOwner { get; private set; } 24 | 25 | public int EventVersion { get; set; } 26 | public DateTime OccurredOn { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumDescriptionChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class ForumDescriptionChanged : IDomainEvent 13 | { 14 | public ForumDescriptionChanged(Tenant tenantId, ForumId forumId, string description, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.Description = description; 19 | this.ExclusiveOwner = exclusiveOwner; 20 | } 21 | 22 | public Tenant TenantId { get; private set; } 23 | public ForumId ForumId { get; private set; } 24 | public string Description { get; private set; } 25 | public string ExclusiveOwner { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public class ForumId : SaaSOvation.Common.Domain.Model.Identity 9 | { 10 | public ForumId(string id) 11 | : base(id) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumIdentityService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public class ForumIdentityService 9 | { 10 | public ForumIdentityService(IDiscussionRepository discussionRepository, IForumRepository forumRepository, IPostRepository postRepository) 11 | { 12 | this.discussionRepository = discussionRepository; 13 | this.forumRepository = forumRepository; 14 | this.postRepository = postRepository; 15 | } 16 | 17 | readonly IDiscussionRepository discussionRepository; 18 | readonly IForumRepository forumRepository; 19 | readonly IPostRepository postRepository; 20 | 21 | public DiscussionId GetNextDiscussionId() 22 | { 23 | return this.discussionRepository.GetNextIdentity(); 24 | } 25 | 26 | public ForumId GetNextForumId() 27 | { 28 | return this.forumRepository.GetNextIdentity(); 29 | } 30 | 31 | public PostId GetNexPostId() 32 | { 33 | return this.postRepository.GetNextIdentity(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumModeratorChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class ForumModeratorChanged : IDomainEvent 13 | { 14 | public ForumModeratorChanged(Tenant tenantId, ForumId forumId, Moderator moderator,string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.Moderator = moderator; 19 | this.ExclusiveOwner = exclusiveOwner; 20 | } 21 | 22 | public Tenant TenantId { get; private set; } 23 | public ForumId ForumId { get; private set; } 24 | public Moderator Moderator { get; private set; } 25 | public string ExclusiveOwner { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumReopened.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class ForumReopened : IDomainEvent 13 | { 14 | public ForumReopened(Tenant tenantId, ForumId forumId, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.ExclusiveOwner = exclusiveOwner; 19 | } 20 | 21 | public Tenant TenantId { get; private set; } 22 | public ForumId ForumId { get; private set; } 23 | public string ExclusiveOwner { get; private set; } 24 | 25 | public int EventVersion { get; set; } 26 | public DateTime OccurredOn { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumStarted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class ForumStarted : IDomainEvent 13 | { 14 | public ForumStarted(Tenant tenantId, ForumId forumId, Creator creator, Moderator moderator, string subject, string description, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.Creator = creator; 19 | this.Moderator = moderator; 20 | this.Subject = subject; 21 | this.Description = description; 22 | this.ExclusiveOwner = exclusiveOwner; 23 | } 24 | 25 | public Tenant TenantId { get; private set; } 26 | public ForumId ForumId { get; private set; } 27 | public Creator Creator { get; private set; } 28 | public Moderator Moderator { get; private set; } 29 | public string Subject { get; private set; } 30 | public string Description { get; private set; } 31 | public string ExclusiveOwner { get; private set; } 32 | 33 | public int EventVersion { get; set; } 34 | public DateTime OccurredOn { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/ForumSubjectChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class ForumSubjectChanged : IDomainEvent 13 | { 14 | public ForumSubjectChanged(Tenant tenantId, ForumId forumId, string subject, string exclusiveOwner) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.Subject = subject; 19 | this.ExclusiveOwner = exclusiveOwner; 20 | } 21 | 22 | public Tenant TenantId { get; private set; } 23 | public ForumId ForumId { get; private set; } 24 | public string Subject { get; private set; } 25 | public string ExclusiveOwner { get; private set; } 26 | 27 | public int EventVersion { get; set; } 28 | public DateTime OccurredOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/IDiscussionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public interface IDiscussionRepository 9 | { 10 | Discussion Get(Tenants.Tenant tenantId, DiscussionId discussionId); 11 | 12 | DiscussionId GetNextIdentity(); 13 | 14 | void Save(Discussion discussion); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/IForumRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public interface IForumRepository 9 | { 10 | Forum Get(Tenants.Tenant tenantId, ForumId forumId); 11 | 12 | ForumId GetNextIdentity(); 13 | 14 | void Save(Forum forum); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/IPostRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public interface IPostRepository 9 | { 10 | Post Get(Tenants.Tenant tenantId, PostId postId); 11 | 12 | PostId GetNextIdentity(); 13 | 14 | void Save(Post post); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/PostContentAltered.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class PostedContentAltered : IDomainEvent 13 | { 14 | public PostedContentAltered(Tenant tenantId, ForumId forumId, DiscussionId discussionId, PostId postId, string subject, string bodyText) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.DiscussionId = discussionId; 19 | this.PostId = postId; 20 | this.Subject = subject; 21 | this.BodyText = bodyText; 22 | } 23 | 24 | public Tenant TenantId { get; private set; } 25 | public ForumId ForumId { get; private set; } 26 | public DiscussionId DiscussionId { get; private set; } 27 | public PostId PostId { get; private set; } 28 | public string Subject { get; private set; } 29 | public string BodyText { get; private set; } 30 | 31 | public int EventVersion { get; set; } 32 | public DateTime OccurredOn { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/PostId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 7 | { 8 | public class PostId : SaaSOvation.Common.Domain.Model.Identity 9 | { 10 | public PostId(string id) 11 | : base(id) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Forums/PostedToDiscussion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | using SaaSOvation.Collaboration.Domain.Model.Tenants; 8 | using SaaSOvation.Collaboration.Domain.Model.Collaborators; 9 | 10 | namespace SaaSOvation.Collaboration.Domain.Model.Forums 11 | { 12 | public class PostedToDiscussion : IDomainEvent 13 | { 14 | public PostedToDiscussion(Tenant tenantId, ForumId forumId, DiscussionId discussionId, PostId postId, Author author, string subject, string bodyText, PostId replyToPostId) 15 | { 16 | this.TenantId = tenantId; 17 | this.ForumId = forumId; 18 | this.DiscussionId = discussionId; 19 | this.PostId = postId; 20 | this.Author = author; 21 | this.Subject = subject; 22 | this.BodyText = bodyText; 23 | this.ReplyToPostId = replyToPostId; 24 | } 25 | 26 | public Tenant TenantId { get; private set; } 27 | public ForumId ForumId { get; private set; } 28 | public DiscussionId DiscussionId { get; private set; } 29 | public PostId PostId { get; private set; } 30 | public Author Author { get; private set; } 31 | public string Subject { get; private set; } 32 | public string BodyText { get; private set; } 33 | public PostId ReplyToPostId { get; private set; } 34 | 35 | public int EventVersion { get; set; } 36 | public DateTime OccurredOn { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iddd_collaboration/Domain.Model/Tenants/Tenant.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Collaboration.Domain.Model.Tenants 16 | { 17 | public sealed class Tenant : SaaSOvation.Common.Domain.Model.Identity 18 | { 19 | public Tenant(string id) 20 | : base(id) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_collaboration/IDDD.Collaboration.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IDDD.Collaboration 5 | 1.0.0 6 | IDDD.Collaboration 7 | Vaughn Vernon 8 | Vaughn Vernon 9 | false 10 | Sample "Collaboration" Bounded Context from the book "Implementing Domain-Driven Design" by Vaughn Vernon 11 | 12 | Copyright © 2012,2013 Vaughn Vernon 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /iddd_collaboration/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("SaaSOvation.Collaboration")] 10 | [assembly: AssemblyDescription("Sample \"Collaboration\" Bounded Context from the book \"Implementing Domain-Driven Design\" by Vaughn Vernon")] 11 | [assembly: AssemblyCompany("SaaSOvation")] 12 | [assembly: AssemblyProduct("Collaboration")] 13 | [assembly: AssemblyCopyright("Copyright © 2012,2013 Vaughn Vernon")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: CLSCompliant(true)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // Synchronize these with the values in the nuspec file. 26 | [assembly: AssemblyVersion("1.0.0.0")] 27 | [assembly: AssemblyFileVersion("1.0.0.0")] 28 | 29 | // Setting ComVisible to false makes the types in this assembly not visible 30 | // to COM components. If you need to access a type in this assembly from 31 | // COM, set the ComVisible attribute to true on that type. 32 | [assembly: ComVisible(false)] 33 | 34 | // The following GUID is for the ID of the typelib if this project is exposed to COM 35 | [assembly: Guid("d0a11db0-2436-4e8e-a70b-a6bdf848f346")] 36 | 37 | // For unit tests 38 | [assembly: InternalsVisibleTo("SaaSOvation.Collaboration.Tests")] 39 | -------------------------------------------------------------------------------- /iddd_collaboration/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | ..\Settings.StyleCop 4 | Linked 5 | 6 | -------------------------------------------------------------------------------- /iddd_collaboration/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/Entity.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Common.Domain.Model 16 | { 17 | using System.Linq; 18 | using System.Collections.Generic; 19 | 20 | public abstract class Entity { } 21 | 22 | public abstract class EntityWithCompositeId : Entity 23 | { 24 | /// 25 | /// When overriden in a derived class, gets all components of the identity of the entity. 26 | /// 27 | /// 28 | protected abstract IEnumerable GetIdentityComponents(); 29 | 30 | public override bool Equals(object obj) 31 | { 32 | if (object.ReferenceEquals(this, obj)) return true; 33 | if (object.ReferenceEquals(null, obj)) return false; 34 | if (GetType() != obj.GetType()) return false; 35 | var other = obj as EntityWithCompositeId; 36 | return GetIdentityComponents().SequenceEqual(other.GetIdentityComponents()); 37 | } 38 | 39 | public override int GetHashCode() 40 | { 41 | return HashCodeHelper.CombineHashCodes(GetIdentityComponents()); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/EventSourcedRootEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Common.Domain.Model 7 | { 8 | public abstract class EventSourcedRootEntity : EntityWithCompositeId 9 | { 10 | public EventSourcedRootEntity() 11 | { 12 | this.mutatingEvents = new List(); 13 | } 14 | 15 | public EventSourcedRootEntity(IEnumerable eventStream, int streamVersion) 16 | : this() 17 | { 18 | foreach (var e in eventStream) 19 | When(e); 20 | this.unmutatedVersion = streamVersion; 21 | } 22 | 23 | readonly List mutatingEvents; 24 | readonly int unmutatedVersion; 25 | 26 | protected int MutatedVersion 27 | { 28 | get { return this.unmutatedVersion + 1; } 29 | } 30 | 31 | protected int UnmutatedVersion 32 | { 33 | get { return this.unmutatedVersion; } 34 | } 35 | 36 | public IList GetMutatingEvents() 37 | { 38 | return this.mutatingEvents.ToArray(); 39 | } 40 | 41 | void When(IDomainEvent e) 42 | { 43 | (this as dynamic).Apply(e); 44 | } 45 | 46 | protected void Apply(IDomainEvent e) 47 | { 48 | this.mutatingEvents.Add(e); 49 | When(e); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/HashCodeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Common.Domain.Model 7 | { 8 | internal static class HashCodeHelper 9 | { 10 | public static int CombineHashCodes(IEnumerable objs) 11 | { 12 | unchecked 13 | { 14 | var hash = 17; 15 | foreach (var obj in objs) 16 | hash = hash * 23 + (obj != null ? obj.GetHashCode() : 0); 17 | return hash; 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/IDomainEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Common.Domain.Model 16 | { 17 | using System; 18 | 19 | public interface IDomainEvent 20 | { 21 | int EventVersion { get; set; } 22 | DateTime OccurredOn { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/IDomainEventSubscriber.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Common.Domain.Model 16 | { 17 | using System; 18 | 19 | public interface IDomainEventSubscriber where T : IDomainEvent 20 | { 21 | void HandleEvent(T domainEvent); 22 | Type SubscribedToEventType(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/IIdentity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Common.Domain.Model 7 | { 8 | public interface IIdentity 9 | { 10 | string Id { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/LongRunningProcess/IProcess.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Common.Domain.Model.LongRunningProcess 16 | { 17 | using System; 18 | 19 | public interface IProcess 20 | { 21 | long AllowableDuration(); 22 | 23 | bool CanTimeout(); 24 | 25 | long CurrentDuration(); 26 | 27 | string Description(); 28 | 29 | bool DidProcessingComplete(); 30 | 31 | void InformTimeout(DateTime timedOutDate); 32 | 33 | bool IsCompleted(); 34 | 35 | bool IsTimedOut(); 36 | 37 | bool NotCompleted(); 38 | 39 | ProcessCompletionType ProcessCompletionType(); 40 | 41 | ProcessId ProcessId(); 42 | 43 | DateTime StartTime(); 44 | 45 | TimeConstrainedProcessTracker TimeConstrainedProcessTracker(); 46 | 47 | DateTime TimedOutDate(); 48 | 49 | long TotalAllowableDuration(); 50 | 51 | int TotalRetriesPermitted(); 52 | } 53 | 54 | public enum ProcessCompletionType 55 | { 56 | NotCompleted, 57 | CompletedNormally, 58 | TimedOut 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/LongRunningProcess/ITimeConstrainedProcessTrackerRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Common.Domain.Model.LongRunningProcess 7 | { 8 | public interface ITimeConstrainedProcessTrackerRepository 9 | { 10 | void Add(TimeConstrainedProcessTracker processTracker); 11 | 12 | ICollection GetAllTimedOut(); 13 | 14 | ICollection GetAllTimedOutOf(string tenantId); 15 | 16 | ICollection GetAll(string tenantId); 17 | 18 | void Save(TimeConstrainedProcessTracker processTracker); 19 | 20 | TimeConstrainedProcessTracker Get(string tenantId, ProcessId processId); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/LongRunningProcess/ProcessId.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Common.Domain.Model.LongRunningProcess 16 | { 17 | using System; 18 | 19 | public class ProcessId : Identity 20 | { 21 | public static ProcessId ExistingProcessId(string id) 22 | { 23 | return new ProcessId(id); 24 | } 25 | 26 | public static ProcessId NewProcessId() 27 | { 28 | return new ProcessId(Guid.NewGuid().ToString()); 29 | } 30 | 31 | public ProcessId(string id) 32 | : base(id) 33 | { 34 | } 35 | 36 | public ProcessId() 37 | : base() 38 | { 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /iddd_common/Domain.Model/LongRunningProcess/ProcessTimedOut.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.Common.Domain.Model.LongRunningProcess 16 | { 17 | using System; 18 | 19 | public class ProcessTimedOut : IDomainEvent 20 | { 21 | public ProcessTimedOut( 22 | string tenantId, 23 | ProcessId processId, 24 | int totalRetriesPermitted, 25 | int retryCount) 26 | { 27 | this.EventVersion = 1; 28 | this.OccurredOn = DateTime.Now; 29 | this.ProcessId = processId; 30 | this.RetryCount = retryCount; 31 | this.TenantId = tenantId; 32 | this.TotalRetriesPermitted = totalRetriesPermitted; 33 | } 34 | 35 | public int EventVersion { get; set; } 36 | public DateTime OccurredOn { get; set; } 37 | public ProcessId ProcessId { get; private set; } 38 | public int RetryCount { get; private set; } 39 | public string TenantId { get; private set; } 40 | public int TotalRetriesPermitted { get; private set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iddd_common/Events/EventSerializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Newtonsoft.Json; 7 | 8 | using SaaSOvation.Common.Domain.Model; 9 | 10 | namespace SaaSOvation.Common.Events 11 | { 12 | public class EventSerializer 13 | { 14 | readonly static Lazy instance = new Lazy(() => new EventSerializer(), true); 15 | 16 | public static EventSerializer Instance 17 | { 18 | get { return instance.Value; } 19 | } 20 | 21 | public EventSerializer(bool isPretty = false) 22 | { 23 | this.isPretty = isPretty; 24 | } 25 | 26 | readonly bool isPretty; 27 | 28 | public T Deserialize(string serialization) 29 | { 30 | return JsonConvert.DeserializeObject(serialization); 31 | } 32 | 33 | public object Deserialize(string serialization, Type type) 34 | { 35 | return JsonConvert.DeserializeObject(serialization, type); 36 | } 37 | 38 | public string Serialize(IDomainEvent domainEvent) 39 | { 40 | return JsonConvert.SerializeObject(domainEvent, this.isPretty ? Formatting.Indented : Formatting.None); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /iddd_common/Events/IEventStore.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.Common.Events 9 | { 10 | public interface IEventStore 11 | { 12 | long CountStoredEvents(); 13 | 14 | StoredEvent[] GetAllStoredEventsSince(long storedEventId); 15 | 16 | StoredEvent[] GetAllStoredEventsBetween(long lowStoredEventId, long highStoredEventId); 17 | 18 | StoredEvent Append(IDomainEvent domainEvent); 19 | 20 | void Close(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iddd_common/IDDD.Common.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IDDD.Common 5 | 1.0.0 6 | IDDD.Common 7 | Vaughn Vernon 8 | Vaughn Vernon 9 | false 10 | Sample Common Core for DDD from the book "Implementing Domain-Driven Design" by Vaughn Vernon 11 | 12 | Copyright © 2012,2013 Vaughn Vernon 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /iddd_common/Notifications/INotificationPublisher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Common.Notifications 7 | { 8 | public interface INotificationPublisher 9 | { 10 | void PublishNotifications(); 11 | 12 | bool InternalOnlyTestConfirmation(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iddd_common/Notifications/Notification.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.Common.Notifications 9 | { 10 | [Serializable] 11 | public class Notification : ValueObject 12 | { 13 | public Notification(long notificationId, IDomainEvent domainEvent) 14 | { 15 | AssertionConcern.AssertArgumentNotNull(domainEvent, "The event is required."); 16 | 17 | this.notificationId = notificationId; 18 | this.domainEvent = domainEvent; 19 | this.occurredOn = domainEvent.OccurredOn; 20 | this.version = domainEvent.EventVersion; 21 | this.typeName = domainEvent.GetType().FullName; 22 | } 23 | 24 | readonly long notificationId; 25 | readonly IDomainEvent domainEvent; 26 | readonly DateTime occurredOn; 27 | readonly string typeName; 28 | readonly int version; 29 | 30 | public TEvent GetEvent() where TEvent : IDomainEvent 31 | { 32 | return (TEvent)this.domainEvent; 33 | } 34 | 35 | public long NotificationId 36 | { 37 | get { return this.notificationId; } 38 | } 39 | 40 | public DateTime OccurredOn 41 | { 42 | get { return this.occurredOn; } 43 | } 44 | 45 | public int Version 46 | { 47 | get { return this.version; } 48 | } 49 | 50 | public string TypeName 51 | { 52 | get { return this.typeName; } 53 | } 54 | 55 | protected override IEnumerable GetEqualityComponents() 56 | { 57 | yield return this.notificationId; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /iddd_common/Notifications/NotificationLogInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.Common.Notifications 7 | { 8 | public class NotificationLogInfo 9 | { 10 | public NotificationLogInfo(NotificationLogId notificationLogId, long totalLogged) 11 | { 12 | this.notificationLogId = notificationLogId; 13 | this.totalLogged = totalLogged; 14 | } 15 | 16 | readonly NotificationLogId notificationLogId; 17 | 18 | public NotificationLogId NotificationLogId 19 | { 20 | get { return notificationLogId; } 21 | } 22 | 23 | readonly long totalLogged; 24 | 25 | public long TotalLogged 26 | { 27 | get { return totalLogged; } 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("SaaSOvation.Common")] 10 | [assembly: AssemblyDescription("Sample Common Core for DDD from the book \"Implementing Domain-Driven Design\" by Vaughn Vernon")] 11 | [assembly: AssemblyCompany("SaaSOvation")] 12 | [assembly: AssemblyProduct("Common Core for DDD")] 13 | [assembly: AssemblyCopyright("Copyright © 2012,2013 Vaughn Vernon")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: CLSCompliant(true)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // Synchronize these with the values in the nuspec file. 26 | [assembly: AssemblyVersion("1.0.0.0")] 27 | [assembly: AssemblyFileVersion("1.0.0.0")] 28 | 29 | // Setting ComVisible to false makes the types in this assembly not visible 30 | // to COM components. If you need to access a type in this assembly from 31 | // COM, set the ComVisible attribute to true on that type. 32 | [assembly: ComVisible(false)] 33 | 34 | // The following GUID is for the ID of the typelib if this project is exposed to COM 35 | [assembly: Guid("335fb093-20b7-4741-a634-464b147de100")] 36 | 37 | // For unit tests 38 | [assembly: InternalsVisibleTo("SaaSOvation.Common.Tests")] 39 | -------------------------------------------------------------------------------- /iddd_common/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | ..\Settings.StyleCop 4 | Linked 5 | 6 | -------------------------------------------------------------------------------- /iddd_common/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /iddd_common/packages.config.orig: -------------------------------------------------------------------------------- 1 |  2 | 3 | <<<<<<< HEAD 4 | 5 | 6 | ======= 7 | 8 | >>>>>>> vs2013 9 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ActivateTenantCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ActivateTenantCommand 9 | { 10 | public ActivateTenantCommand() { } 11 | 12 | public ActivateTenantCommand(string tenantId) 13 | { 14 | this.TenantId = tenantId; 15 | } 16 | 17 | public string TenantId { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/AddGroupToGroupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class AddGroupToGroupCommand 9 | { 10 | public AddGroupToGroupCommand() 11 | { 12 | } 13 | 14 | public AddGroupToGroupCommand(string tenantId, string childGroupName, string parentGroupName) 15 | { 16 | this.TenantId = tenantId; 17 | this.ChildGroupName = childGroupName; 18 | this.ParentGroupName = parentGroupName; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string ChildGroupName { get; set; } 23 | public string ParentGroupName { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/AddUserToGroupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class AddUserToGroupCommand 9 | { 10 | public AddUserToGroupCommand() 11 | { 12 | } 13 | 14 | public AddUserToGroupCommand(string tenantId, string groupName, string userNmae) 15 | { 16 | this.TenantId = tenantId; 17 | this.GroupName = groupName; 18 | this.Username = userNmae; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string GroupName { get; set; } 23 | public string Username { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/AssignUserToGroupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class AssignUserToGroupCommand 9 | { 10 | public AssignUserToGroupCommand() 11 | { 12 | } 13 | 14 | public AssignUserToGroupCommand(string tenantId, string groupName, string userName) 15 | { 16 | this.TenantId = tenantId; 17 | this.GroupName = groupName; 18 | this.Username = userName; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string GroupName { get; set; } 23 | public string Username { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/AssignUserToRoleCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class AssignUserToRoleCommand 9 | { 10 | public AssignUserToRoleCommand() 11 | { 12 | } 13 | 14 | public AssignUserToRoleCommand(string tenantId, string userName, string roleName) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.RoleName = roleName; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string Username { get; set; } 23 | public string RoleName { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/AuthenticateUserCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class AuthenticateUserCommand 9 | { 10 | public AuthenticateUserCommand() 11 | { 12 | } 13 | 14 | public AuthenticateUserCommand(string tenantId, string userName, string password) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.Password = password; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string Username { get; set; } 23 | public string Password { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangeContactInfoCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangeContactInfoCommand 9 | { 10 | public ChangeContactInfoCommand() 11 | { 12 | } 13 | 14 | public ChangeContactInfoCommand(string tenantId, string username, string emailAddress, 15 | string primaryTelephone, string secondaryTelephone, string addressStreetAddress, 16 | string addressCity, string addressStateProvince, string addressPostalCode, 17 | string addressCountryCode) 18 | { 19 | this.TenantId = tenantId; 20 | this.Username = username; 21 | this.EmailAddress = emailAddress; 22 | this.PrimaryTelephone = primaryTelephone; 23 | this.SecondaryTelephone = secondaryTelephone; 24 | this.AddressStreetAddress = addressStreetAddress; 25 | this.AddressCity = addressCity; 26 | this.AddressStateProvince = addressStateProvince; 27 | this.AddressPostalCode = addressPostalCode; 28 | this.AddressCountryCode = addressCountryCode; 29 | } 30 | 31 | public string TenantId { get; set; } 32 | public string Username { get; set; } 33 | public string EmailAddress { get; set; } 34 | public string PrimaryTelephone { get; set; } 35 | public string SecondaryTelephone { get; set; } 36 | public string AddressStreetAddress { get; set; } 37 | public string AddressCity { get; set; } 38 | public string AddressStateProvince { get; set; } 39 | public string AddressPostalCode { get; set; } 40 | public string AddressCountryCode { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangeEmailAddressCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangeEmailAddressCommand 9 | { 10 | public ChangeEmailAddressCommand() 11 | { 12 | } 13 | 14 | public ChangeEmailAddressCommand(string tenantId, string userName, string emailAddress) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.EmailAddress = emailAddress; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string Username { get; set; } 23 | public string EmailAddress { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangePostalAddressCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangePostalAddressCommand 9 | { 10 | public ChangePostalAddressCommand(string tenantId, string username, 11 | string addressStreetAddress, string addressCity, string addressStateProvince, string addressPostalCode, string addressCountryCode) 12 | { 13 | this.TenantId = tenantId; 14 | this.Username = username; 15 | this.AddressStreetAddress = addressStreetAddress; 16 | this.AddressCity = addressCity; 17 | this.AddressStateProvince = addressStateProvince; 18 | this.AddressPostalCode = addressPostalCode; 19 | this.AddressCountryCode = addressCountryCode; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string Username { get; set; } 24 | public string AddressStreetAddress { get; set; } 25 | public string AddressCity { get; set; } 26 | public string AddressStateProvince { get; set; } 27 | public string AddressPostalCode { get; set; } 28 | public string AddressCountryCode { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangePrimaryTelephoneCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangePrimaryTelephoneCommand 9 | { 10 | public ChangePrimaryTelephoneCommand() 11 | { 12 | } 13 | 14 | public ChangePrimaryTelephoneCommand(string tenantId, string userName, string telephone) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.Telephone = telephone; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string Username { get; set; } 23 | public string Telephone { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangeSecondaryTelephoneCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangeSecondaryTelephoneCommand 9 | { 10 | public ChangeSecondaryTelephoneCommand() 11 | { 12 | } 13 | 14 | public ChangeSecondaryTelephoneCommand(string tenantId, string userName, string telephone) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.Telephone = telephone; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string Username { get; set; } 23 | public string Telephone { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangeUserPasswordCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangeUserPasswordCommand 9 | { 10 | public ChangeUserPasswordCommand() 11 | { 12 | } 13 | 14 | public ChangeUserPasswordCommand(string tenantId, string userName, string currentPassword, string changedPassword) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.CurrentPassword = currentPassword; 19 | this.ChangedPassword = changedPassword; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string Username { get; set; } 24 | public string CurrentPassword { get; set; } 25 | public string ChangedPassword { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ChangeUserPersonalNameCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ChangeUserPersonalNameCommand 9 | { 10 | public ChangeUserPersonalNameCommand() 11 | { 12 | } 13 | 14 | public ChangeUserPersonalNameCommand(string tenantId, string userName, string firstName, string lastName) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.FirstName = firstName; 19 | this.LastName = lastName; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string Username { get; set; } 24 | public string FirstName { get; set; } 25 | public string LastName { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/DeactivateTenantCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class DeactivateTenantCommand 9 | { 10 | public DeactivateTenantCommand() 11 | { 12 | } 13 | 14 | public DeactivateTenantCommand(string tenantId, string userName, string firstName, string lastName) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.FirstName = firstName; 19 | this.LastName = lastName; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string Username { get; set; } 24 | public string FirstName { get; set; } 25 | public string LastName { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/DefineUserEnablementCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class DefineUserEnablementCommand 9 | { 10 | public DefineUserEnablementCommand() 11 | { 12 | } 13 | 14 | public DefineUserEnablementCommand(string tenantId, string userName, string enabled, DateTime startDate, DateTime endDate) 15 | { 16 | this.TenantId = tenantId; 17 | this.Username = userName; 18 | this.StartDate = startDate; 19 | this.EndDate = endDate; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string Username { get; set; } 24 | public bool Enabled { get; set; } 25 | public DateTime StartDate { get; set; } 26 | public DateTime EndDate { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ProvisionGroupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ProvisionGroupCommand 9 | { 10 | public ProvisionGroupCommand() 11 | { 12 | } 13 | 14 | public ProvisionGroupCommand(string tenantId, string groupName, string description) 15 | { 16 | this.TenantId = tenantId; 17 | this.GroupName = groupName; 18 | this.Description = description; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string GroupName { get; set; } 23 | public string Description { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/ProvisionRoleCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class ProvisionRoleCommand 9 | { 10 | public ProvisionRoleCommand() 11 | { 12 | } 13 | 14 | public ProvisionRoleCommand(string tenantId, string roleName, string description, bool supportsNesting) 15 | { 16 | this.TenantId = tenantId; 17 | this.RoleName = roleName; 18 | this.Description = description; 19 | this.SupportsNesting = supportsNesting; 20 | } 21 | 22 | public string TenantId { get; set; } 23 | public string RoleName { get; set; } 24 | public string Description { get; set; } 25 | public bool SupportsNesting { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/RemoveGroupFromGroupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class RemoveGroupFromGroupCommand 9 | { 10 | public RemoveGroupFromGroupCommand() 11 | { 12 | } 13 | 14 | public RemoveGroupFromGroupCommand(String tenantId, String parentGroupName, String childGroupName) 15 | { 16 | this.TenantId = tenantId; 17 | this.ParentGroupName = parentGroupName; 18 | this.ChildGroupName = childGroupName; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string ChildGroupName { get; set; } 23 | public string ParentGroupName { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/Commands/RemoveUserFromGroupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Application.Commands 7 | { 8 | public class RemoveUserFromGroupCommand 9 | { 10 | public RemoveUserFromGroupCommand() 11 | { 12 | } 13 | 14 | public RemoveUserFromGroupCommand(String tenantId, String groupName, String username) 15 | { 16 | this.TenantId = tenantId; 17 | this.GroupName = groupName; 18 | this.Username = username; 19 | } 20 | 21 | public string TenantId { get; set; } 22 | public string GroupName { get; set; } 23 | public string Username { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/IdentityAccessEventProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Events; 7 | using SaaSOvation.Common.Domain.Model; 8 | 9 | namespace SaaSOvation.IdentityAccess.Application 10 | { 11 | public class IdentityAccessEventProcessor 12 | { 13 | public IdentityAccessEventProcessor(IEventStore eventStore) 14 | { 15 | this.eventStore = eventStore; 16 | } 17 | 18 | readonly IEventStore eventStore; 19 | 20 | public void Listen() 21 | { 22 | DomainEventPublisher.Instance.Subscribe(domainEvent => this.eventStore.Append(domainEvent)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iddd_identityaccess/Application/NotificationApplicationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Notifications; 7 | using SaaSOvation.Common.Events; 8 | 9 | namespace SaaSOvation.IdentityAccess.Application 10 | { 11 | public class NotificationApplicationService 12 | { 13 | public NotificationApplicationService(IEventStore eventStore, INotificationPublisher notificationPublisher) 14 | { 15 | this.eventStore = eventStore; 16 | this.notificationPublisher = notificationPublisher; 17 | } 18 | 19 | readonly IEventStore eventStore; 20 | readonly INotificationPublisher notificationPublisher; 21 | 22 | public NotificationLog GetCurrentNotificationLog() 23 | { 24 | return new NotificationLogFactory(this.eventStore) 25 | .CreateCurrentNotificationLog(); 26 | } 27 | 28 | public NotificationLog GetNotificationLog(string notificationLogId) 29 | { 30 | return new NotificationLogFactory(this.eventStore) 31 | .CreateNotificationLog(new NotificationLogId(notificationLogId)); 32 | } 33 | 34 | public void PublishNotifications() 35 | { 36 | this.notificationPublisher.PublishNotifications(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Access/GroupAssignedToRole.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.IdentityAccess.Domain.Model.Access 16 | { 17 | using System; 18 | using SaaSOvation.Common.Domain.Model; 19 | using SaaSOvation.IdentityAccess.Domain.Model.Identity; 20 | 21 | public class GroupAssignedToRole : IDomainEvent 22 | { 23 | public GroupAssignedToRole(TenantId tenantId, string roleName, string groupName) 24 | { 25 | this.EventVersion = 1; 26 | this.GroupName = groupName; 27 | this.OccurredOn = DateTime.Now; 28 | this.RoleName = roleName; 29 | this.TenantId = tenantId; 30 | } 31 | 32 | public int EventVersion { get; set; } 33 | 34 | public string GroupName { get; private set; } 35 | 36 | public DateTime OccurredOn { get; set; } 37 | 38 | public string RoleName { get; private set; } 39 | 40 | public TenantId TenantId; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Access/GroupUnassignedFromRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.IdentityAccess.Domain.Model.Identity; 7 | 8 | namespace SaaSOvation.IdentityAccess.Domain.Model.Access 9 | { 10 | public class GroupUnassignedFromRole : SaaSOvation.Common.Domain.Model.IDomainEvent 11 | { 12 | public GroupUnassignedFromRole(TenantId tenantId, string roleName, string groupName) 13 | { 14 | this.EventVersion = 1; 15 | this.GroupName = groupName; 16 | this.OccurredOn = DateTime.Now; 17 | this.RoleName = roleName; 18 | this.TenantId = tenantId; 19 | } 20 | 21 | public int EventVersion { get; set; } 22 | 23 | public string GroupName { get; private set; } 24 | 25 | public DateTime OccurredOn { get; set; } 26 | 27 | public string RoleName { get; private set; } 28 | 29 | public TenantId TenantId { get; private set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Access/RoleProvisioned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.IdentityAccess.Domain.Model.Identity; 7 | 8 | namespace SaaSOvation.IdentityAccess.Domain.Model.Access 9 | { 10 | public class RoleProvisioned : SaaSOvation.Common.Domain.Model.IDomainEvent 11 | { 12 | public RoleProvisioned(TenantId tenantId, string name) 13 | { 14 | this.EventVersion = 1; 15 | this.Name = name; 16 | this.OccurredOn = DateTime.Now; 17 | this.TenantId = tenantId.Id; 18 | } 19 | 20 | public int EventVersion { get; set; } 21 | 22 | public string Name { get; private set; } 23 | 24 | public DateTime OccurredOn { get; set; } 25 | 26 | public string TenantId { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Access/UserAssginedToRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.IdentityAccess.Domain.Model.Identity; 7 | 8 | namespace SaaSOvation.IdentityAccess.Domain.Model.Access 9 | { 10 | public class UserAssignedToRole : SaaSOvation.Common.Domain.Model.IDomainEvent 11 | { 12 | public UserAssignedToRole( 13 | TenantId tenantId, 14 | string roleName, 15 | string username, 16 | string firstName, 17 | string lastName, 18 | string emailAddress) 19 | { 20 | this.EmailAddress = emailAddress; 21 | this.EventVersion = 1; 22 | this.FirstName = firstName; 23 | this.LastName = lastName; 24 | this.OccurredOn = DateTime.Now; 25 | this.RoleName = roleName; 26 | this.TenantId = tenantId; 27 | this.Username = username; 28 | } 29 | 30 | public string EmailAddress { get; private set; } 31 | 32 | public int EventVersion { get; set; } 33 | 34 | public string FirstName { get; private set; } 35 | 36 | public string LastName { get; private set; } 37 | 38 | public DateTime OccurredOn { get; set; } 39 | 40 | public string RoleName { get; private set; } 41 | 42 | public TenantId TenantId { get; private set; } 43 | 44 | public string Username { get; private set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Access/UserUnassignedFromRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.IdentityAccess.Domain.Model.Identity; 7 | 8 | namespace SaaSOvation.IdentityAccess.Domain.Model.Access 9 | { 10 | public class UserUnassignedFromRole : SaaSOvation.Common.Domain.Model.IDomainEvent 11 | { 12 | public UserUnassignedFromRole(TenantId tenantId, string roleName, string username) 13 | { 14 | this.EventVersion = 1; 15 | this.OccurredOn = DateTime.Now; 16 | this.RoleName = roleName; 17 | this.TenantId = tenantId; 18 | this.Username = username; 19 | } 20 | 21 | public int EventVersion { get; set; } 22 | 23 | public string Username { get; private set; } 24 | 25 | public DateTime OccurredOn { get; set; } 26 | 27 | public string RoleName { get; private set; } 28 | 29 | public TenantId TenantId { get; private set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/DomainRegistry.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.IdentityAccess.Domain.Model 16 | { 17 | using System; 18 | 19 | using SaaSOvation.IdentityAccess.Domain.Model.Identity; 20 | 21 | /// 22 | /// Holds static references to domain services 23 | /// which would normally be configured by an 24 | /// Inversion of Control container. 25 | /// 26 | [CLSCompliant(true)] 27 | public static class DomainRegistry 28 | { 29 | /// 30 | /// Gets the instance of to use. 31 | /// 32 | public static IEncryptionService EncryptionService 33 | { 34 | get 35 | { 36 | // this is not a desirable dependency since it 37 | // references port adapters, but it doesn't 38 | // require an IoC container 39 | return new Infrastructure.Services.MD5EncryptionService(); 40 | } 41 | } 42 | 43 | /// 44 | /// Gets an instance of a domain service which generates 45 | /// passwords and evaluates passwords for strength. 46 | /// 47 | public static PasswordService PasswordService 48 | { 49 | get { return new PasswordService(); } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/EmailAddress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 9 | { 10 | public class EmailAddress : ValueObject 11 | { 12 | public EmailAddress(string address) 13 | { 14 | this.Address = address; 15 | } 16 | 17 | public EmailAddress(EmailAddress emailAddress) 18 | : this(emailAddress.Address) 19 | { 20 | } 21 | 22 | protected EmailAddress() { } 23 | 24 | string address; 25 | 26 | public string Address 27 | { 28 | get 29 | { 30 | return this.address; 31 | } 32 | set 33 | { 34 | AssertionConcern.AssertArgumentNotEmpty(value, "The email address is required."); 35 | AssertionConcern.AssertArgumentLength(value, 1, 100, "Email address must be 100 characters or less."); 36 | AssertionConcern.AssertArgumentMatches( 37 | "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*", 38 | value, 39 | "Email address format is invalid."); 40 | 41 | this.address = value; 42 | } 43 | } 44 | 45 | public override string ToString() 46 | { 47 | return "EmailAddress [address=" + Address + "]"; 48 | } 49 | 50 | protected override System.Collections.Generic.IEnumerable GetEqualityComponents() 51 | { 52 | yield return address.ToUpper(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/GroupGroupAdded.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 16 | { 17 | using System; 18 | using SaaSOvation.Common.Domain.Model; 19 | 20 | public class GroupGroupAdded : IDomainEvent 21 | { 22 | public GroupGroupAdded(TenantId tenantId, string groupName, string nestedGroupName) 23 | { 24 | this.EventVersion = 1; 25 | this.GroupName = groupName; 26 | this.NestedGroupName = nestedGroupName; 27 | this.OccurredOn = DateTime.Now; 28 | this.TenantId = tenantId.Id; 29 | } 30 | 31 | public int EventVersion { get; set; } 32 | 33 | public string GroupName { get; private set; } 34 | 35 | public string NestedGroupName { get; private set; } 36 | 37 | public DateTime OccurredOn { get; set; } 38 | 39 | public string TenantId { get; private set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/GroupGroupRemoved.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class GroupGroupRemoved : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public GroupGroupRemoved(TenantId tenantId, string groupName, string nestedGroupName) 11 | { 12 | this.EventVersion = 1; 13 | this.GroupName = groupName; 14 | this.NestedGroupName = nestedGroupName; 15 | this.OccurredOn = DateTime.Now; 16 | this.TenantId = tenantId.Id; 17 | } 18 | 19 | public int EventVersion { get; set; } 20 | 21 | public string GroupName { get; private set; } 22 | 23 | public string NestedGroupName { get; private set; } 24 | 25 | public DateTime OccurredOn { get; set; } 26 | 27 | public string TenantId { get; private set; } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/GroupMemberType.cs: -------------------------------------------------------------------------------- 1 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 2 | { 3 | using System; 4 | 5 | /// 6 | /// Enumeration of the types of items which may 7 | /// be placed within a . 8 | /// 9 | [CLSCompliant(true)] 10 | public enum GroupMemberType : byte 11 | { 12 | /// 13 | /// Indicates that the group member is a . 14 | /// 15 | Group = 0, 16 | 17 | /// 18 | /// Indicates that the group member is a . 19 | /// 20 | User = 1 21 | } 22 | } -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/GroupProvisioned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class GroupProvisioned : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public GroupProvisioned(TenantId tenantId, string name) 11 | { 12 | this.EventVersion = 1; 13 | this.Name = name; 14 | this.OccurredOn = DateTime.Now; 15 | this.TenantId = tenantId.Id; 16 | } 17 | 18 | public int EventVersion { get; set; } 19 | 20 | public string Name { get; private set; } 21 | 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public string TenantId { get; private set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/GroupUserAdded.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class GroupUserAdded : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public GroupUserAdded(TenantId tenantId, string groupName, string username) 11 | { 12 | this.EventVersion = 1; 13 | this.GroupName = groupName; 14 | this.OccurredOn = DateTime.Now; 15 | this.TenantId = tenantId.Id; 16 | this.Username = username; 17 | } 18 | 19 | public int EventVersion { get; set; } 20 | 21 | public string GroupName { get; private set; } 22 | 23 | public DateTime OccurredOn { get; set; } 24 | 25 | public string TenantId { get; private set; } 26 | 27 | public string Username { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/GroupUserRemoved.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class GroupUserRemoved : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public GroupUserRemoved(TenantId tenantId, string groupName, string username) 11 | { 12 | this.EventVersion = 1; 13 | this.GroupName = groupName; 14 | this.OccurredOn = DateTime.Now; 15 | this.TenantId = tenantId.Id; 16 | this.Username = username; 17 | } 18 | 19 | public int EventVersion { get; set; } 20 | 21 | public string GroupName { get; private set; } 22 | 23 | public DateTime OccurredOn { get; set; } 24 | 25 | public string TenantId { get; private set; } 26 | 27 | public string Username { get; private set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/IEncryptionService.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 16 | { 17 | using System; 18 | 19 | /// 20 | /// Contract for a domain service which encrypts 21 | /// a plain text string to use as a password. 22 | /// 23 | [CLSCompliant(true)] 24 | public interface IEncryptionService 25 | { 26 | /// 27 | /// Encrypts a given plain text string and returns the cipher text. 28 | /// Typically, the returned value should be a one-way hash of the 29 | /// given , and not cipher text 30 | /// which could be decrypted with a key. 31 | /// 32 | /// 33 | /// A plain text string representing a password, 34 | /// to be hashed before it is stored. 35 | /// 36 | /// 37 | /// A string which is one-way cryptographic hash 38 | /// of the given . 39 | /// 40 | string EncryptedValue(string plainTextValue); 41 | } 42 | } -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/InvitationDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 16 | { 17 | using System; 18 | using SaaSOvation.Common.Domain.Model; 19 | 20 | public class InvitationDescriptor 21 | { 22 | public InvitationDescriptor(TenantId tenantId, string invitationId, string description, DateTime startingOn, DateTime until) 23 | { 24 | this.Description = description; 25 | this.InvitationId = invitationId; 26 | this.StartingOn = startingOn; 27 | this.TenantId = tenantId.Id; 28 | this.Until = until; 29 | } 30 | 31 | public string Description { get; private set; } 32 | 33 | public string InvitationId { get; private set; } 34 | 35 | public DateTime StartingOn; 36 | 37 | public string TenantId { get; private set; } 38 | 39 | public DateTime Until { get; private set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/PersonContactInformationChanged.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 16 | { 17 | using System; 18 | using SaaSOvation.Common.Domain.Model; 19 | 20 | public class PersonContactInformationChanged : IDomainEvent 21 | { 22 | public PersonContactInformationChanged( 23 | TenantId tenantId, 24 | String username, 25 | ContactInformation contactInformation) 26 | { 27 | this.ContactInformation = contactInformation; 28 | this.EventVersion = 1; 29 | this.OccurredOn = DateTime.Now; 30 | this.TenantId = tenantId.Id; 31 | this.Username = username; 32 | } 33 | 34 | public ContactInformation ContactInformation { get; private set; } 35 | 36 | public int EventVersion { get; set; } 37 | 38 | public DateTime OccurredOn { get; set; } 39 | 40 | public string TenantId { get; private set; } 41 | 42 | public string Username { get; private set; } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/PersonNameChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class PersonNameChanged : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public PersonNameChanged( 11 | TenantId tenantId, 12 | String username, 13 | FullName name) 14 | { 15 | this.EventVersion = 1; 16 | this.Name = name; 17 | this.OccurredOn = DateTime.Now; 18 | this.TenantId = tenantId.Id; 19 | this.Username = username; 20 | } 21 | 22 | public int EventVersion { get; set; } 23 | 24 | public FullName Name { get; private set; } 25 | 26 | public DateTime OccurredOn { get; set; } 27 | 28 | public string TenantId { get; private set; } 29 | 30 | public string Username { get; private set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/Telephone.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using SaaSOvation.Common.Domain.Model; 7 | 8 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 9 | { 10 | public class Telephone : ValueObject 11 | { 12 | public Telephone(string number) 13 | { 14 | this.Number = number; 15 | } 16 | 17 | public Telephone(Telephone telephone) 18 | : this(telephone.Number) 19 | { 20 | } 21 | 22 | protected Telephone() { } 23 | 24 | string number; 25 | 26 | public string Number 27 | { 28 | get 29 | { 30 | return this.number; 31 | } 32 | set 33 | { 34 | AssertionConcern.AssertArgumentNotEmpty(value, "Telephone number is required."); 35 | AssertionConcern.AssertArgumentLength(value, 5, 20, "Telephone number may not be more than 20 characters."); 36 | AssertionConcern.AssertArgumentMatches( 37 | "((\\(\\d{3}\\))|(\\d{3}-))\\d{3}-\\d{4}", 38 | value, 39 | "Telephone number or its format is invalid."); 40 | 41 | this.number = value; 42 | } 43 | } 44 | 45 | public override string ToString() 46 | { 47 | return "Telephone [number=" + Number + "]"; 48 | } 49 | 50 | protected override System.Collections.Generic.IEnumerable GetEqualityComponents() 51 | { 52 | yield return this.Number; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/TenantActivated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class TenantActivated : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public TenantActivated(TenantId tenantId) 11 | { 12 | this.EventVersion = 1; 13 | this.OccurredOn = DateTime.Now; 14 | this.TenantId = tenantId.Id; 15 | } 16 | 17 | public int EventVersion { get; set; } 18 | 19 | public DateTime OccurredOn { get; set; } 20 | 21 | public string TenantId { get; private set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/TenantDeactivated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class TenantDeactivated : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public TenantDeactivated(TenantId tenantId) 11 | { 12 | this.EventVersion = 1; 13 | this.OccurredOn = DateTime.Now; 14 | this.TenantId = tenantId.Id; 15 | } 16 | 17 | public int EventVersion { get; set; } 18 | 19 | public DateTime OccurredOn { get; set; } 20 | 21 | public string TenantId { get; private set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/TenantProvisioned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class TenantProvisioned : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public TenantProvisioned(TenantId tenantId) 11 | { 12 | this.EventVersion = 1; 13 | this.OccurredOn = DateTime.Now; 14 | this.TenantId = tenantId.Id; 15 | } 16 | 17 | public int EventVersion { get; set; } 18 | 19 | public DateTime OccurredOn { get; set; } 20 | 21 | public string TenantId { get; private set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/UserEnablementChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class UserEnablementChanged : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public UserEnablementChanged( 11 | TenantId tenantId, 12 | String username, 13 | Enablement enablement) 14 | { 15 | this.Enablement = enablement; 16 | this.EventVersion = 1; 17 | this.OccurredOn = DateTime.Now; 18 | this.TenantId = tenantId.Id; 19 | this.Username = username; 20 | } 21 | 22 | public Enablement Enablement { get; private set; } 23 | 24 | public int EventVersion { get; set; } 25 | 26 | public DateTime OccurredOn { get; set; } 27 | 28 | public string TenantId { get; private set; } 29 | 30 | public string Username { get; private set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/UserPasswordChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class UserPasswordChanged : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public UserPasswordChanged( 11 | TenantId tenantId, 12 | String username) 13 | { 14 | this.EventVersion = 1; 15 | this.OccurredOn = DateTime.Now; 16 | this.TenantId = tenantId.Id; 17 | this.Username = username; 18 | } 19 | 20 | public int EventVersion { get; set; } 21 | 22 | public DateTime OccurredOn { get; set; } 23 | 24 | public string TenantId { get; private set; } 25 | 26 | public string Username { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /iddd_identityaccess/Domain.Model/Identity/UserRegistered.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SaaSOvation.IdentityAccess.Domain.Model.Identity 7 | { 8 | public class UserRegistered : SaaSOvation.Common.Domain.Model.IDomainEvent 9 | { 10 | public UserRegistered( 11 | TenantId tenantId, 12 | String username, 13 | FullName name, 14 | EmailAddress emailAddress) 15 | { 16 | this.EmailAddress = emailAddress; 17 | this.EventVersion = 1; 18 | this.Name = name; 19 | this.OccurredOn = DateTime.Now; 20 | this.TenantId = tenantId.Id; 21 | this.Username = username; 22 | } 23 | 24 | public EmailAddress EmailAddress { get; private set; } 25 | 26 | public int EventVersion { get; set; } 27 | 28 | public FullName Name { get; private set; } 29 | 30 | public DateTime OccurredOn { get; set; } 31 | 32 | public string TenantId { get; private set; } 33 | 34 | public string Username { get; private set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /iddd_identityaccess/IDDD.IdentityAccess.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IDDD.IdentityAccess 5 | 1.0.0 6 | IDDD.IdentityAccess 7 | Vaughn Vernon 8 | Vaughn Vernon 9 | false 10 | Sample "Identity and Access" Bounded Context from the book "Implementing Domain-Driven Design" by Vaughn Vernon 11 | 12 | Copyright © 2012,2013 Vaughn Vernon 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /iddd_identityaccess/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("SaaSOvation.IdentityAccess")] 10 | [assembly: AssemblyDescription("Sample \"Identity and Access\" Bounded Context from the book \"Implementing Domain-Driven Design\" by Vaughn Vernon")] 11 | [assembly: AssemblyCompany("SaaSOvation")] 12 | [assembly: AssemblyProduct("Identity and Access")] 13 | [assembly: AssemblyCopyright("Copyright © 2012,2013 Vaughn Vernon")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: CLSCompliant(true)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // Synchronize these with the values in the nuspec file. 26 | [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyFileVersion("1.0.0.0")] 28 | 29 | // Setting ComVisible to false makes the types in this assembly not visible 30 | // to COM components. If you need to access a type in this assembly from 31 | // COM, set the ComVisible attribute to true on that type. 32 | [assembly: ComVisible(false)] 33 | 34 | // The following GUID is for the ID of the typelib if this project is exposed to COM 35 | [assembly: Guid("41131856-b684-4c73-a15b-d61ac76cfa06")] 36 | 37 | // For unit tests 38 | [assembly: InternalsVisibleTo("SaaSOvation.IdentityAccess.Tests")] 39 | -------------------------------------------------------------------------------- /iddd_identityaccess/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | ..\Settings.StyleCop 4 | Linked 5 | 6 | -------------------------------------------------------------------------------- /iddd_identityaccess/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------