├── .gitattributes ├── .gitignore ├── 05 - Domain Model Implementation Patterns ├── PPPDDDChap05.DomainModel │ ├── PPPDDDChap05.DomainModel.sln │ └── PPPDDDChap05.DomainModel │ │ ├── Application │ │ └── BidOnAuctionService.cs │ │ ├── Model │ │ ├── Auction.cs │ │ ├── Bid.cs │ │ ├── ClassDiagram.cd │ │ ├── HistoricalBid.cs │ │ ├── IAuctionRepository.cs │ │ ├── Money.cs │ │ ├── Price.cs │ │ └── WinningBid.cs │ │ ├── PPPDDDChap05.DomainModel.csproj │ │ └── Properties │ │ └── AssemblyInfo.cs ├── PPPDDDChap05.TableModule │ ├── PPPDDDChap05.TableModule.sln │ └── PPPDDDChap05.TableModule │ │ ├── Domain │ │ ├── Customers.cs │ │ ├── Orders.cs │ │ └── TableModuleBase.cs │ │ ├── PPPDDDChap05.TableModule.csproj │ │ └── Properties │ │ └── AssemblyInfo.cs └── PPPDDDChap05.TransactionScript │ ├── PPPDDDChap05.TransactionScript.sln │ └── PPPDDDChap05.TransactionScript │ ├── Application │ └── BidOnAuctionService.cs │ ├── Domain │ ├── Auction.cs │ ├── BidOnAuction.cs │ ├── BidOnAuctionCommand.cs │ ├── ClassDiagram1.cd │ ├── CreateAuction.cs │ └── ICommand.cs │ ├── PPPDDDChap05.TransactionScript.csproj │ └── Properties │ └── AssemblyInfo.cs ├── 10 - Applying the Principles, Practices and Patterns of DDD └── PPPDDD.Chap10.ecommerce │ ├── PPPDDD.Chap10.ecommerce.sln │ └── PPPDDD.Chap10.ecommerce │ ├── ExplicitLogic │ └── Model │ │ ├── BasketItem.cs │ │ ├── BasketItemFactory.cs │ │ ├── BasketItems.cs │ │ ├── Country.cs │ │ ├── OverSeasSellingPolicyException.cs │ │ ├── OverseasSellingPolicy.cs │ │ ├── Product.cs │ │ ├── Quantity.cs │ │ └── basket.cs │ ├── ImplicitLogic │ └── Model │ │ ├── BasketItem.cs │ │ ├── BasketItemFactory.cs │ │ ├── BasketItems.cs │ │ ├── Product.cs │ │ ├── Quantity.cs │ │ └── basket.cs │ ├── PPPDDD.Chap10.ecommerce.csproj │ └── Properties │ └── AssemblyInfo.cs ├── 11 - Integrating Bounded Contexts └── README.md ├── 12 - Integrating Via Messaging ├── Billing.Messages │ ├── Billing.Messages.csproj │ ├── Commands │ │ └── RecordPaymentAttempt.cs │ ├── Events │ │ └── PaymentAccepted.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Billing.Payments.PaymentAccepted │ ├── App.config │ ├── Billing.Payments.PaymentAccepted.csproj │ ├── EndpointConfig.cs │ ├── OrderCreatedHandler.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RecordPaymentAttemptHandler.cs │ └── packages.config ├── DDDesign.Web │ ├── App_Start │ │ ├── FilterConfig.cs │ │ ├── RouteConfig.cs │ │ └── WebApiConfig.cs │ ├── Controllers │ │ └── OrdersController.cs │ ├── DDDesign.Web.csproj │ ├── Global.asax │ ├── Global.asax.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Views │ │ ├── Orders │ │ │ └── Index.cshtml │ │ └── Web.config │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── packages.config ├── DDDesign.sln ├── Promotions.LuckyWinner.LuckyWinnerSelected.Bridge │ ├── App.config │ ├── Application │ │ └── OrderCreatedHandler.cs │ ├── Infrastructure │ │ └── EndpointConfig.cs │ ├── Promotions.LuckyWinner.LuckyWinnerSelected.Bridge.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── Promotions.LuckyWinner.LuckyWinnerSelected │ ├── App.config │ ├── Application │ │ └── Program.cs │ ├── Promotions.LuckyWinner.LuckyWinnerSelected.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── README.md ├── Sales.Messages │ ├── Commands │ │ └── PlaceOrder.cs │ ├── Events │ │ ├── OrderCreated.cs │ │ └── OrderCreated_V2.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Sales.Messages.csproj ├── Sales.Orders.OrderCreated │ ├── App.config │ ├── Application │ │ └── PlaceOrderHandler.cs │ ├── Infrastructure │ │ └── EndpointConfig.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sales.Orders.OrderCreated.csproj │ └── packages.config ├── Shipping.BusinessCustomers.ShippingArranged │ ├── App.config │ ├── Application │ │ └── Handlers.cs │ ├── Infrastructure │ │ └── EndpointConfig.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Shipping.BusinessCustomers.ShippingArranged.csproj │ └── packages.config └── Shipping.Messages │ ├── Events │ └── ShippingArranged.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── Shipping.Messages.csproj ├── 13 - Integrating Via Http and Rest ├── PPPDDD.JSON.SocialMedia │ ├── AccountManagement │ │ ├── AccountManagement.csproj │ │ ├── App_Start │ │ │ └── WebApiConfig.cs │ │ ├── Controllers │ │ │ └── FollowerDirectoryController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config │ ├── Discovery │ │ ├── App_Start │ │ │ └── WebApiConfig.cs │ │ ├── Controllers │ │ │ └── RecommenderController.cs │ │ ├── Discovery.csproj │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config │ └── PPPDDD.JSON.SocialMedia.sln ├── PPPDDD.REST.SocialMedia │ ├── .gitignore │ ├── AccountManagement.Accounts.Api │ │ ├── AccountManagement.Accounts.Api.csproj │ │ ├── App_Start │ │ │ └── WebApiConfig.cs │ │ ├── Controllers │ │ │ ├── AccountsController.cs │ │ │ └── FollowersController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config │ ├── AccountManagement.EntryPoint │ │ ├── .gitignore │ │ ├── AccountManagement.EntryPoint.Api.csproj │ │ ├── App_Start │ │ │ └── WebApiConfig.cs │ │ ├── Controllers │ │ │ └── EntryPointController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── MIT-LICENSE.txt │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── README.md │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── browser.html │ │ ├── js │ │ │ ├── hal.js │ │ │ └── hal │ │ │ │ ├── browser.js │ │ │ │ ├── http │ │ │ │ └── client.js │ │ │ │ ├── resource.js │ │ │ │ └── views │ │ │ │ ├── browser.js │ │ │ │ ├── documentation.js │ │ │ │ ├── embedded_resource.js │ │ │ │ ├── embedded_resources.js │ │ │ │ ├── explorer.js │ │ │ │ ├── inspector.js │ │ │ │ ├── links.js │ │ │ │ ├── location_bar.js │ │ │ │ ├── navigation.js │ │ │ │ ├── non_safe_request_dialog.js │ │ │ │ ├── properties.js │ │ │ │ ├── query_uri_dialog.js │ │ │ │ ├── request_headers.js │ │ │ │ ├── resource.js │ │ │ │ ├── response.js │ │ │ │ ├── response_body.js │ │ │ │ └── response_headers.js │ │ ├── packages.config │ │ ├── styles.css │ │ └── vendor │ │ │ ├── css │ │ │ ├── bootstrap-responsive.css │ │ │ └── bootstrap.css │ │ │ ├── img │ │ │ ├── ajax-loader.gif │ │ │ ├── glyphicons-halflings-white.png │ │ │ └── glyphicons-halflings.png │ │ │ └── js │ │ │ ├── backbone.js │ │ │ ├── bootstrap.js │ │ │ ├── jquery-1.10.2.js │ │ │ ├── jquery-1.10.2.min.js │ │ │ ├── jquery-1.10.2.min.map │ │ │ ├── underscore.js │ │ │ └── uritemplates.js │ ├── AccountManagement.RegularAccounts.BeganFollowing │ │ ├── AccountManagement.RegularAccounts.BeganFollowing.csproj │ │ ├── App_Start │ │ │ ├── EnableCorsAttribute.cs │ │ │ └── WebApiConfig.cs │ │ ├── Controllers │ │ │ └── BeganFollowingController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config │ ├── Discovery.Reccommendations.Followers │ │ ├── BeganFollowingPollingFeedConsumer.cs │ │ ├── Discovery.Reccommendations.Followers.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── PPPDDD.REST.SocialMedia.sln ├── PPPDDD.SOAP.SocialMedia │ ├── AccountManagement │ │ ├── AccountManagement.csproj │ │ ├── FollowerDirectory.svc │ │ ├── FollowerDirectory.svc.cs │ │ ├── IFollowerDirectory.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ └── Web.config │ ├── Discovery │ │ ├── Discovery.csproj │ │ ├── IRecommender.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Recommender.svc │ │ ├── Recommender.svc.cs │ │ ├── Service References │ │ │ └── AccountManagement │ │ │ │ ├── Discovery.AccountManagement.Follower.datasource │ │ │ │ ├── FollowerDirectory.disco │ │ │ │ ├── FollowerDirectory.wsdl │ │ │ │ ├── FollowerDirectory.xsd │ │ │ │ ├── FollowerDirectory1.xsd │ │ │ │ ├── FollowerDirectory2.xsd │ │ │ │ ├── FollowerDirectory3.xsd │ │ │ │ ├── Reference.cs │ │ │ │ ├── Reference.svcmap │ │ │ │ ├── configuration.svcinfo │ │ │ │ └── configuration91.svcinfo │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ └── Web.config │ └── PPPDDD.SOAP.SocialMedia.sln └── README.md ├── 14 - Introducing Domain Modelling Patterns and Best Practices └── README.md ├── 15 - Value Objects ├── Examples │ ├── BankAccount │ │ └── BankAccount.cs │ ├── Examples.csproj │ ├── Model │ │ ├── BankAccount.cs │ │ ├── Customer.cs │ │ ├── Meters.cs │ │ ├── MicroTypes.cs │ │ ├── Money.cs │ │ ├── Name.cs │ │ └── ValueObject.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── app.config │ └── packages.config ├── PPPDDD.Chap16.ValueObjects.sln ├── README.md └── Tests │ ├── Tests.sln │ └── Tests │ ├── Combining_money_tests.cs │ ├── DateTime_immutability_tests.cs │ ├── Denormalized_persistence_example.cs │ ├── Meters_equality_tests.cs │ ├── Micro_types_example_tests.cs │ ├── Name_validation_tests.cs │ ├── Normalized_persistence_example.cs │ ├── Persistence_format_examples.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Tests.csproj │ ├── TimeSpan_factory_method_tests.cs │ ├── app.config │ └── packages.config ├── 16 - Entities ├── PPPDDDChap17.Entities.Examples │ ├── Customer.cs │ ├── Model │ │ ├── Book.cs │ │ ├── Dice.cs │ │ ├── FlightBooking.cs │ │ ├── GlobalCounter.cs │ │ ├── HolidayBooking.cs │ │ ├── Hotel.cs │ │ ├── OnlineTakeawayOrder.cs │ │ ├── SoccerMatch.cs │ │ └── Vehicle.cs │ ├── PPPDDDChap17.Entities.Examples.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── PPPDDDChap17.Entities.Tests │ ├── BookTests.cs │ ├── DatastoreIdGenerationExample.cs │ ├── FlightBookingTests.cs │ ├── GlobalCounterTest.cs │ ├── HolidayBookingTest.cs │ ├── HotelTests.cs │ ├── PPPDDDChap17.Entities.Tests.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── app.config │ └── packages.config ├── PPPDDDChap17.Entities.sln └── README.md ├── 17 - Domain Services ├── PPPDDDChap18.DomainServices.sln ├── PPPDDDChap18.DomainServices │ ├── Insurance │ │ ├── Application │ │ │ └── MultiMemberInsurancePremium.cs │ │ └── Model │ │ │ ├── IMemberRepository.cs │ │ │ ├── IMultiMemberPremiumCalculator.cs │ │ │ ├── IPolicyRepository.cs │ │ │ ├── Member.cs │ │ │ ├── Policy.cs │ │ │ └── Quote.cs │ ├── OnlineDating │ │ └── Model │ │ │ ├── BloodType.cs │ │ │ ├── CompatibilityRating.cs │ │ │ ├── LoveSeeker.cs │ │ │ └── RomanceOMeter.cs │ ├── OnlineGaming │ │ ├── WithDomainServices │ │ │ └── Model │ │ │ │ ├── Competitor.cs │ │ │ │ ├── IGame.cs │ │ │ │ ├── IGameRewardPolicy.cs │ │ │ │ ├── IGameScoringPolicy.cs │ │ │ │ ├── IScoreFinder.cs │ │ │ │ ├── OnlineDeathmatch.cs │ │ │ │ ├── Ranking.cs │ │ │ │ └── Score.cs │ │ └── WithoutDomainServices │ │ │ └── Model │ │ │ ├── Competitor.cs │ │ │ ├── OnlineDeathmatch.cs │ │ │ ├── Ranking.cs │ │ │ └── Score.cs │ ├── PPPDDDChap18.DomainServices.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RestaurantBooking │ │ └── Model │ │ │ ├── BookingDetails.cs │ │ │ ├── Customer.cs │ │ │ ├── DomainEvents.cs │ │ │ ├── Events │ │ │ └── BookingConfirmedByCustomer.cs │ │ │ ├── Handlers │ │ │ └── NotifyRestaurantOnCustomerBookingConfirmation.cs │ │ │ ├── IHandleEvents.cs │ │ │ ├── Restaurant.cs │ │ │ ├── RestaurantBooking.cs │ │ │ ├── RestaurantBookingFactory.cs │ │ │ ├── RestaurantBookingRepository.cs │ │ │ └── RestaurantNotifier.cs │ └── Shipping │ │ ├── Application │ │ └── ShippingRouteFinder.cs │ │ └── Model │ │ └── IShippingRouteFinder.cs └── README.md ├── 18 - Domain Events ├── .nuget │ ├── NuGet.Config │ ├── NuGet.exe │ └── NuGet.targets ├── DomainEvents.OnlineTakeawayStore.sln ├── OnlineTakeawayStore.NServiceBus │ ├── App.config │ ├── Application │ │ ├── ConfirmDeliveryOfOrder.cs │ │ └── Events │ │ │ └── RefundDueToLateDelivery.cs │ ├── Infrastructure │ │ └── EndpointConfig.cs │ ├── Model │ │ ├── Events │ │ │ └── DeliveryGuaranteeFailed.cs │ │ ├── FoodDeliveryOrderSteps.cs │ │ ├── IDeliveryGuaranteeOffer.cs │ │ ├── IOrderRepository.cs │ │ └── OrderForDelivery.cs │ ├── OnlineTakeawayStore.NServiceBus.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── OnlineTakeawayStore.NativeEvents │ ├── Application │ │ ├── CofirmDeliveryOfOrder.cs │ │ └── Events │ │ │ └── RefundDueToLateDelivery.cs │ ├── Model │ │ ├── Events │ │ │ └── DeliveryGuaranteeFailed.cs │ │ ├── FoodDeliveryOrderSteps.cs │ │ ├── IDeliveryGuaranteeOffer.cs │ │ ├── IOrderRepository.cs │ │ └── OrderForDelivery.cs │ ├── OnlineTakeawayStore.NativeEvents.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── OnlineTakeawayStore.ReturnEvents │ ├── Application │ │ └── ConfirmDeliveryOfOrder.cs │ ├── Infrastructure │ │ └── IEventDispatcher.cs │ ├── Model │ │ ├── Events │ │ │ └── DeliveryGuaranteeFailed.cs │ │ ├── FoodDeliveryOrderSteps.cs │ │ ├── IDeliveryGuaranteeOffer.cs │ │ ├── IOrderRepository.cs │ │ └── OrderForDelivery.cs │ ├── OnlineTakeawayStore.ReturnEvents.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── OnlineTakeawayStore.StaticDomainEvents │ ├── Application │ │ ├── ConfirmDeliveryOfOrder.cs │ │ └── Events │ │ │ └── RefundDueToLateDelivery.cs │ ├── Infrastructure │ │ └── DomainEvents.cs │ ├── Model │ │ ├── Events │ │ │ └── DeliveryGuaranteeFailed.cs │ │ ├── FoodDeliveryOrderSteps.cs │ │ ├── IDeliveryGuaranteeOffer.cs │ │ ├── IOrderRepository.cs │ │ └── OrderForDelivery.cs │ ├── OnlineTakeawayStore.StaticDomainEvents.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config └── OnlineTakeawayStore.Tests │ ├── OnlineTakeawayStore.Tests.csproj │ ├── Properties │ └── AssemblyInfo.cs │ ├── ServiceLayerTestExamples │ └── Delivery_guarantee_failed.cs │ ├── UnitTestExamples │ ├── ReturnDomainEvents.cs │ └── StaticDomainEvents.cs │ └── packages.config ├── 19 - Aggregates ├── PPPDDDChap19.eBidder │ ├── PPPDDDChap19.eBidder.Common │ │ ├── PPPDDDChap19.eBidder.Common.csproj │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── PPPDDDChap19.eBidder.Disputes │ │ ├── PPPDDDChap19.eBidder.Disputes.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── _ReadMe.txt │ ├── PPPDDDChap19.eBidder.Listings │ │ ├── Application │ │ │ ├── Auctions │ │ │ │ └── BusinessUseCases │ │ │ │ │ ├── AuctionCreation.cs │ │ │ │ │ ├── BidOnAuctionService.cs │ │ │ │ │ └── CreateAuctionService.cs │ │ │ ├── QandA │ │ │ │ └── BusinessUseCases │ │ │ │ │ ├── Answer.cs │ │ │ │ │ ├── AnswerAQuestionService.cs │ │ │ │ │ └── AskAQuestionService.cs │ │ │ └── Watching │ │ │ │ └── BusinessUseCases │ │ │ │ ├── UnWatchItem.cs │ │ │ │ ├── WatchItem.cs │ │ │ │ └── WatchItemService.cs │ │ ├── Infrastructure │ │ │ ├── DomainEvents.cs │ │ │ ├── Entity.cs │ │ │ ├── IClock.cs │ │ │ ├── SystemClock.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ ├── ListingFormat │ │ │ │ ├── Auctions │ │ │ │ │ ├── Auction.cs │ │ │ │ │ ├── AuctionId.cs │ │ │ │ │ ├── AutomaticBidder.cs │ │ │ │ │ ├── BidHistory │ │ │ │ │ │ ├── Bid.cs │ │ │ │ │ │ └── IBidHistoryRepository.cs │ │ │ │ │ ├── BidPlaced.cs │ │ │ │ │ ├── IAuctionRepository.cs │ │ │ │ │ ├── Offer.cs │ │ │ │ │ ├── OutBid.cs │ │ │ │ │ ├── Price.cs │ │ │ │ │ └── WinningBid.cs │ │ │ │ └── FixedPriceListings │ │ │ │ │ ├── FixedPriceListing.cs │ │ │ │ │ ├── IFixedPriceListingRepository.cs │ │ │ │ │ └── Offers │ │ │ │ │ └── BestOffer.cs │ │ │ ├── Listings │ │ │ │ ├── FormatType.cs │ │ │ │ ├── IListingRepository.cs │ │ │ │ ├── Listing.cs │ │ │ │ ├── ListingFormat.cs │ │ │ │ ├── ListingRevision.cs │ │ │ │ └── ListingRevisionEvent.cs │ │ │ ├── Members │ │ │ │ ├── IMemberService.cs │ │ │ │ └── Member.cs │ │ │ ├── Money.cs │ │ │ ├── MoneyCannotBeANegativeValueException.cs │ │ │ ├── MoreThanTwoDecimalPlacesInMoneyValueException.cs │ │ │ ├── QandA │ │ │ │ ├── Answer.cs │ │ │ │ ├── IQuestionRepository.cs │ │ │ │ ├── Question.cs │ │ │ │ ├── QuestionAnswered.cs │ │ │ │ └── QuestionSubmitted.cs │ │ │ ├── Sellers │ │ │ │ ├── ISellerService.cs │ │ │ │ └── Seller.cs │ │ │ └── WatchLists │ │ │ │ ├── IWatchedItemRepository.cs │ │ │ │ └── WatchedItem.cs │ │ ├── PPPDDDChap19.eBidder.Listings.csproj │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── PPPDDDChap19.eBidder.Membership │ │ ├── Model │ │ │ └── Members │ │ │ │ ├── IMemberRepository.cs │ │ │ │ └── Member.cs │ │ ├── PPPDDDChap19.eBidder.Membership.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── _ReadMe.txt │ ├── PPPDDDChap19.eBidder.SellerAccount │ │ ├── PPPDDDChap19.eBidder.SellerAccount.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── _ReadMe.txt │ └── PPPDDDChap19.eBidder.sln └── README.md ├── 20 - Factories └── README.md ├── 21 - Repositories ├── DDDPPP.Chap21.EFExample │ ├── .nuget │ │ ├── NuGet.Config │ │ ├── NuGet.exe │ │ └── NuGet.targets │ ├── DDDPPP.Chap21.EFExample.Application │ │ ├── App.config │ │ ├── Application │ │ │ ├── BusinessUseCases │ │ │ │ ├── BidOnAuction.cs │ │ │ │ ├── CreateAuction.cs │ │ │ │ └── NewAuctionRequest.cs │ │ │ └── Queries │ │ │ │ ├── AuctionStatus.cs │ │ │ │ ├── AuctionStatusQuery.cs │ │ │ │ ├── BidHistoryQuery.cs │ │ │ │ └── BidInformation.cs │ │ ├── Bootstrapper.cs │ │ ├── DDDPPP.Chap21.EFExample.Application.csproj │ │ ├── Infrastructure │ │ │ ├── AuctionDatabaseContext.cs │ │ │ ├── AuctionRepository.cs │ │ │ ├── BidHistoryRepository.cs │ │ │ ├── DataModel │ │ │ │ ├── AuctionDTO.cs │ │ │ │ └── BidDTO.cs │ │ │ ├── DomainEvents.cs │ │ │ ├── Entity.cs │ │ │ ├── IClock.cs │ │ │ ├── Mapping │ │ │ │ ├── AuctionMap.cs │ │ │ │ └── BidMap.cs │ │ │ ├── SystemClock.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ ├── Auction │ │ │ │ ├── Auction.cs │ │ │ │ ├── AuctionSnapshot.cs │ │ │ │ ├── AutomaticBidder.cs │ │ │ │ ├── BidPlaced.cs │ │ │ │ ├── IAuctionRepository.cs │ │ │ │ ├── Money.cs │ │ │ │ ├── MoneyCannotBeANegativeValueException.cs │ │ │ │ ├── MoneySnapshot.cs │ │ │ │ ├── MoreThanTwoDecimalPlacesInMoneyValueException.cs │ │ │ │ ├── Offer.cs │ │ │ │ ├── OutBid.cs │ │ │ │ ├── Price.cs │ │ │ │ ├── WinningBid.cs │ │ │ │ └── WinningBidSnapshot.cs │ │ │ └── BidHistory │ │ │ │ ├── Bid.cs │ │ │ │ ├── BidHistory.cs │ │ │ │ └── IBidHistoryRepository.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── DDDPPP.Chap21.EFExample.Presentation │ │ ├── App.config │ │ ├── DDDPPP.Chap21.EFExample.Presentation.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── DDDPPP.Chap21.EFExample.sln ├── DDDPPP.Chap21.MicroORM │ ├── .nuget │ │ ├── NuGet.Config │ │ ├── NuGet.exe │ │ └── NuGet.targets │ ├── DDDPPP.Chap21.MicroORM.Application │ │ ├── Application │ │ │ ├── BusinessUseCases │ │ │ │ ├── BidOnAuction.cs │ │ │ │ ├── CreateAuction.cs │ │ │ │ └── NewAuctionRequest.cs │ │ │ └── Queries │ │ │ │ ├── AuctionStatus.cs │ │ │ │ ├── AuctionStatusQuery.cs │ │ │ │ ├── BidHistoryQuery.cs │ │ │ │ └── BidInformation.cs │ │ ├── Bootstrapper.cs │ │ ├── DDDPPP.Chap21.MicroORM.Application.csproj │ │ ├── Infrastructure │ │ │ ├── AuctionRepository.cs │ │ │ ├── BidHistoryRepository.cs │ │ │ ├── ConcurrencyException.cs │ │ │ ├── DataModel │ │ │ │ ├── AuctionDTO.cs │ │ │ │ └── BidDTO.cs │ │ │ ├── DomainEvents.cs │ │ │ ├── Entity.cs │ │ │ ├── IAggregateDataModel.cs │ │ │ ├── IClock.cs │ │ │ ├── IUnitOfWork.cs │ │ │ ├── IUnitOfWorkRepository.cs │ │ │ ├── SystemClock.cs │ │ │ ├── UnitOfWork.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ ├── Auction │ │ │ │ ├── Auction.cs │ │ │ │ ├── AuctionSnapshot.cs │ │ │ │ ├── Bid.cs │ │ │ │ ├── BidPlaced.cs │ │ │ │ ├── IAuctionRepository.cs │ │ │ │ ├── Money.cs │ │ │ │ ├── MoneyCannotBeANegativeValueException.cs │ │ │ │ ├── MoneySnapshot.cs │ │ │ │ ├── MoreThanTwoDecimalPlacesInMoneyValueException.cs │ │ │ │ ├── OutBid.cs │ │ │ │ ├── Price.cs │ │ │ │ ├── WinningBid.cs │ │ │ │ └── WinningBidSnapshot.cs │ │ │ └── BidHistory │ │ │ │ ├── BidHistory.cs │ │ │ │ ├── HistoricalBid.cs │ │ │ │ └── IBidHistoryRepository.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── DDDPPP.Chap21.MicroORM.Presentation │ │ ├── App.config │ │ ├── DDDPPP.Chap21.MicroORM.Presentation.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── DDDPPP.Chap21.MicroORM.sln ├── DDDPPP.Chap21.NHibernateExample │ ├── .nuget │ │ ├── NuGet.Config │ │ ├── NuGet.exe │ │ └── NuGet.targets │ ├── DDDPPP.Chap21.NHibernateExample.Application │ │ ├── Application │ │ │ ├── BusinessUseCases │ │ │ │ ├── BidOnAuction.cs │ │ │ │ ├── CreateAuction.cs │ │ │ │ └── NewAuctionRequest.cs │ │ │ └── Queries │ │ │ │ ├── AuctionStatus.cs │ │ │ │ ├── AuctionStatusQuery.cs │ │ │ │ ├── BidHistoryQuery.cs │ │ │ │ └── BidInformation.cs │ │ ├── Bootstrapper.cs │ │ ├── DDDPPP.Chap21.NHibernateExample.Application.csproj │ │ ├── Infrastructure │ │ │ ├── Auction.hbm.xml │ │ │ ├── AuctionRepository.cs │ │ │ ├── Bid.hbm.xml │ │ │ ├── BidHistoryRepository.cs │ │ │ ├── DomainEvents.cs │ │ │ ├── Entity.cs │ │ │ ├── IClock.cs │ │ │ ├── SystemClock.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ ├── Auction │ │ │ │ ├── Auction.cs │ │ │ │ ├── AutomaticBidder.cs │ │ │ │ ├── BidPlaced.cs │ │ │ │ ├── IAuctionRepository.cs │ │ │ │ ├── Money.cs │ │ │ │ ├── MoneyCannotBeANegativeValueException.cs │ │ │ │ ├── MoreThanTwoDecimalPlacesInMoneyValueException.cs │ │ │ │ ├── Offer.cs │ │ │ │ ├── OutBid.cs │ │ │ │ ├── Price.cs │ │ │ │ └── WinningBid.cs │ │ │ └── BidHistory │ │ │ │ ├── Bid.cs │ │ │ │ └── IBidHistoryRepository.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── DDDPPP.Chap21.NHibernateExample.Presentation │ │ ├── App.config │ │ ├── DDDPPP.Chap21.NHibernateExample.Presentation.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── DDDPPP.Chap21.NHibernateExample.sln ├── DDDPPP.Chap21.RavenDBExample │ ├── .nuget │ │ ├── NuGet.Config │ │ ├── NuGet.exe │ │ └── NuGet.targets │ ├── DDDPPP.Chap21.RavenDBExample.Application.Tests │ │ ├── DDDPPP.Chap21.RavenDBExample.Application.Tests.csproj │ │ ├── Domain │ │ │ └── AutomaticBidderScenarios.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── DDDPPP.Chap21.RavenDBExample.Application │ │ ├── Application │ │ │ ├── BusinessUseCases │ │ │ │ ├── BidOnAuction.cs │ │ │ │ ├── CreateAuction.cs │ │ │ │ └── NewAuctionRequest.cs │ │ │ └── Queries │ │ │ │ ├── AuctionStatus.cs │ │ │ │ ├── AuctionStatusQuery.cs │ │ │ │ ├── BidHistoryQuery.cs │ │ │ │ └── BidInformation.cs │ │ ├── Bootstrapper.cs │ │ ├── DDDPPP.Chap21.RavenDBExample.Application.csproj │ │ ├── Infrastructure │ │ │ ├── AuctionRepository.cs │ │ │ ├── BidHistoryRepository.cs │ │ │ ├── BidHistory_NumberOfBids.cs │ │ │ ├── DomainEvents.cs │ │ │ ├── Entity.cs │ │ │ ├── IClock.cs │ │ │ ├── SystemClock.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ ├── Auction │ │ │ │ ├── Auction.cs │ │ │ │ ├── AutomaticBidder.cs │ │ │ │ ├── BidPlaced.cs │ │ │ │ ├── IAuctionRepository.cs │ │ │ │ ├── Money.cs │ │ │ │ ├── MoneyCannotBeANegativeValueException.cs │ │ │ │ ├── MoreThanTwoDecimalPlacesInMoneyValueException.cs │ │ │ │ ├── Offer.cs │ │ │ │ ├── OutBid.cs │ │ │ │ ├── Price.cs │ │ │ │ └── WinningBid.cs │ │ │ └── BidHistory │ │ │ │ ├── Bid.cs │ │ │ │ ├── BidHistory.cs │ │ │ │ └── IBidHistoryRepository.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── DDDPPP.Chap21.RavenDBExample.Presentation │ │ ├── App.config │ │ ├── DDDPPP.Chap21.RavenDBExample.Presentation.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── DDDPPP.Chap21.RavenDBExample.sln └── Database_script_for_examples.sql ├── 22 - Event Sourcing ├── PPPDDD.Chap23.EventSourcing.EventStoreDemo │ ├── GetEventStore.cs │ ├── ImportTestData.cs │ ├── PPPDDD.Chap23.EventSourcing.EventStoreDemo.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Tests.cs │ └── packages.config ├── PPPDDDChap22 │ ├── .nuget │ │ ├── NuGet.Config │ │ ├── NuGet.exe │ │ └── NuGet.targets │ ├── PPPDDDChap23.EventSourcing.Application │ │ ├── Application │ │ │ └── BusinessUseCases │ │ │ │ ├── CreateAccount.cs │ │ │ │ ├── RecordPhonecall.cs │ │ │ │ └── TopUpCredit.cs │ │ ├── Bootstrapper.cs │ │ ├── Infrastructure │ │ │ ├── Entity.cs │ │ │ ├── EventSourcedAggregate.cs │ │ │ ├── EventStore.cs │ │ │ ├── EventStream.cs │ │ │ ├── EventWrapper.cs │ │ │ ├── IClock.cs │ │ │ ├── PayAsYouGoAccountRepository.cs │ │ │ ├── SystemClock.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ └── PayAsYouGo │ │ │ │ ├── AccountCreated.cs │ │ │ │ ├── CreditAdded.cs │ │ │ │ ├── CreditSatisfiesFreeCallAllowanceOffer.cs │ │ │ │ ├── FreeCallAllowance.cs │ │ │ │ ├── IPayAsYouGoAccountRepository.cs │ │ │ │ ├── Minutes.cs │ │ │ │ ├── Money.cs │ │ │ │ ├── PayAsYouGoAccount.cs │ │ │ │ ├── PayAsYouGoAccountSnapshot.cs │ │ │ │ ├── PayAsYouGoInclusiveMinutesOffer.cs │ │ │ │ ├── PhoneCall.cs │ │ │ │ ├── PhoneCallCharged.cs │ │ │ │ ├── PhoneCallCosting.cs │ │ │ │ └── PhoneNumber.cs │ │ ├── PPPDDDChap23.EventSourcing.Application.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── PPPDDDChap23.EventSourcing.ApplicationTests │ │ ├── PPPDDDChap23.EventSourcing.ApplicationTests.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── PPPDDDChap23.EventSourcing.Presentation │ │ ├── App.config │ │ ├── PPPDDDChap23.EventSourcing.Presentation.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── PPPDDDChap23.EventSourcing.sln ├── PPPDDDChap23.EventSourcing │ ├── .nuget │ │ ├── NuGet.Config │ │ ├── NuGet.exe │ │ └── NuGet.targets │ ├── PPPDDDChap23.EventSourcing.Application │ │ ├── Application │ │ │ └── BusinessUseCases │ │ │ │ ├── CreateAccount.cs │ │ │ │ ├── RecordPhonecall.cs │ │ │ │ └── TopUpCredit.cs │ │ ├── Bootstrapper.cs │ │ ├── Infrastructure │ │ │ ├── DomainEvent.cs │ │ │ ├── Entity.cs │ │ │ ├── EventSourcedAggregate.cs │ │ │ ├── EventStore.cs │ │ │ ├── EventStream.cs │ │ │ ├── EventWrapper.cs │ │ │ ├── IClock.cs │ │ │ ├── PasAsYouGoSnapshotJob.cs │ │ │ ├── PayAsYouGoAccountRepository.cs │ │ │ ├── SystemClock.cs │ │ │ └── ValueObject.cs │ │ ├── Model │ │ │ └── PayAsYouGo │ │ │ │ ├── AccountCreated.cs │ │ │ │ ├── CreditAdded.cs │ │ │ │ ├── CreditSatisfiesFreeCallAllowanceOffer.cs │ │ │ │ ├── FreeCallAllowance.cs │ │ │ │ ├── IPayAsYouGoAccountRepository.cs │ │ │ │ ├── Minutes.cs │ │ │ │ ├── Money.cs │ │ │ │ ├── PayAsYouGoAccount.cs │ │ │ │ ├── PayAsYouGoAccountSnapshot.cs │ │ │ │ ├── PayAsYouGoInclusiveMinutesOffer.cs │ │ │ │ ├── PhoneCall.cs │ │ │ │ ├── PhoneCallCharged.cs │ │ │ │ ├── PhoneCallCosting.cs │ │ │ │ └── PhoneNumber.cs │ │ ├── PPPDDDChap23.EventSourcing.Application.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── PPPDDDChap23.EventSourcing.ApplicationTests │ │ ├── PPPDDDChap23.EventSourcing.ApplicationTests.csproj │ │ ├── PayAsYouGoAccount_Tests.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── PPPDDDChap23.EventSourcing.Presentation │ │ ├── App.config │ │ ├── PPPDDDChap23.EventSourcing.Presentation.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── PPPDDDChap23.EventSourcing.sln └── README.md ├── 23 - Architecting Application User Interfaces ├── PPPDDD.NonDist.UIComp │ ├── PPPDDD.NonDist.UIComp.sln │ └── PPPDDD.NonDist.UIComp │ │ ├── App_Start │ │ └── RouteConfig.cs │ │ ├── Controllers │ │ ├── CatalogueBoundedContextController.cs │ │ ├── HomeController.cs │ │ ├── PricingBoundedContextController.cs │ │ └── ShippingBoundedContextController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── PPPDDD.NonDist.UIComp.csproj │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── Views │ │ ├── CatalogBoundedContext │ │ │ └── ItemInBasket.cshtml │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── PricingBoundedContext │ │ │ └── Price.cshtml │ │ ├── ShippingBoundedContext │ │ │ └── DeliveryOptions.cshtml │ │ └── web.config │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config ├── PPPSSS.Dist.UIComp │ ├── PPPSSS.Dist.UIComp.sln │ └── PPPSSS.Dist.UIComp │ │ ├── App_Start │ │ └── RouteConfig.cs │ │ ├── Controllers │ │ ├── HolidaysController.cs │ │ ├── HomeController.cs │ │ ├── PromotionsController.cs │ │ └── RecommendationsController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── PPPSSS.Dist.UIComp.csproj │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ └── pppddd-application.js │ │ ├── Views │ │ ├── Home │ │ │ └── Index.cshtml │ │ └── web.config │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config └── README.md ├── 24 - CQRS An Architecture of A Bounded Context └── README.md ├── 25 - Commands Application Service Patterns for processing Business Use Cases ├── .nuget │ ├── NuGet.Config │ ├── NuGet.exe │ └── NuGet.targets ├── DDDPPP.Chap20.CommandHandler.Application │ ├── Application │ │ ├── Api.cs │ │ ├── Commands │ │ │ ├── AddProductToBasketCommand.cs │ │ │ ├── ApplyCouponToBasketCommand.cs │ │ │ ├── CreateABasketCommand.cs │ │ │ ├── RemoveOfferFromBasketCommand.cs │ │ │ ├── RemoveProductFromBasketCommand.cs │ │ │ └── UpdateBasketDeliveryCountry.cs │ │ ├── Contract │ │ │ └── _readme.txt │ │ ├── Handlers │ │ │ ├── AddProductToBasketCommandHandler.cs │ │ │ ├── ApplyCouponToBasketCommandHandler.cs │ │ │ ├── CreateABasketCommandHandler.cs │ │ │ ├── RemoveCouponFromBasketCommandHandler.cs │ │ │ └── RemoveProductFromBasketCommandHandler.cs │ │ └── ReadModel │ │ │ └── Product.cs │ ├── CommandHandlerRegistry.cs │ ├── DDDPPP.Chap20.CommandHandler.Application.csproj │ ├── DomainEventHandlerRegistery.cs │ ├── Infrastructure │ │ ├── BasketRepository.cs │ │ ├── Mapping │ │ │ ├── Basket.hbm.xml │ │ │ ├── BasketItem.hbm.xml │ │ │ ├── BasketVoucher.hbm.xml │ │ │ ├── Offer.hbm.xml │ │ │ └── Product.hbm.xml │ │ └── PromotionsRepository.cs │ ├── Model │ │ ├── Baskets │ │ │ ├── Basket.cs │ │ │ ├── BasketItem.cs │ │ │ ├── BasketItemFactory.cs │ │ │ ├── BasketPricingBreakdown.cs │ │ │ ├── BasketPricingService.cs │ │ │ ├── Events │ │ │ │ ├── BasketCreated.cs │ │ │ │ ├── BasketModified.cs │ │ │ │ ├── BasketPriceChanged.cs │ │ │ │ └── CouponNotApplicableForBasketItems.cs │ │ │ ├── IBasketPricingService.cs │ │ │ ├── IBasketRepository.cs │ │ │ ├── NonNegativeQuantity.cs │ │ │ └── ProductSnapshot.cs │ │ └── Promotions │ │ │ ├── Coupon.cs │ │ │ ├── CouponIssues.cs │ │ │ ├── ICouponPolicy.cs │ │ │ ├── IPromotionsRepository.cs │ │ │ ├── Promotion.cs │ │ │ └── PromotionNotApplicableException.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── DDDPPP.Chap20.CommandHandler.Presentation │ ├── Content │ │ ├── Site.css │ │ └── themes │ │ │ └── base │ │ │ ├── images │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_888888_256x240.png │ │ │ └── ui-icons_cd0a0a_256x240.png │ │ │ ├── jquery-ui.css │ │ │ ├── jquery.ui.accordion.css │ │ │ ├── jquery.ui.all.css │ │ │ ├── jquery.ui.autocomplete.css │ │ │ ├── jquery.ui.base.css │ │ │ ├── jquery.ui.button.css │ │ │ ├── jquery.ui.core.css │ │ │ ├── jquery.ui.datepicker.css │ │ │ ├── jquery.ui.dialog.css │ │ │ ├── jquery.ui.progressbar.css │ │ │ ├── jquery.ui.resizable.css │ │ │ ├── jquery.ui.selectable.css │ │ │ ├── jquery.ui.slider.css │ │ │ ├── jquery.ui.tabs.css │ │ │ ├── jquery.ui.theme.css │ │ │ └── minified │ │ │ ├── images │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_888888_256x240.png │ │ │ └── ui-icons_cd0a0a_256x240.png │ │ │ ├── jquery-ui.min.css │ │ │ ├── jquery.ui.accordion.min.css │ │ │ ├── jquery.ui.autocomplete.min.css │ │ │ ├── jquery.ui.button.min.css │ │ │ ├── jquery.ui.core.min.css │ │ │ ├── jquery.ui.datepicker.min.css │ │ │ ├── jquery.ui.dialog.min.css │ │ │ ├── jquery.ui.progressbar.min.css │ │ │ ├── jquery.ui.resizable.min.css │ │ │ ├── jquery.ui.selectable.min.css │ │ │ ├── jquery.ui.slider.min.css │ │ │ ├── jquery.ui.tabs.min.css │ │ │ └── jquery.ui.theme.min.css │ ├── Controllers │ │ ├── AccountController.cs │ │ └── HomeController.cs │ ├── DDDPPP.Chap20.CommandHandler.Presentation.csproj │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ │ └── AccountModels.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── MicrosoftAjax.debug.js │ │ ├── MicrosoftAjax.js │ │ ├── MicrosoftMvcAjax.debug.js │ │ ├── MicrosoftMvcAjax.js │ │ ├── MicrosoftMvcValidation.debug.js │ │ ├── MicrosoftMvcValidation.js │ │ ├── jquery-1.7.1.intellisense.js │ │ ├── jquery-1.7.1.js │ │ ├── jquery-1.7.1.min.js │ │ ├── jquery-ui-1.8.20.js │ │ ├── jquery-ui-1.8.20.min.js │ │ ├── jquery.unobtrusive-ajax.js │ │ ├── jquery.unobtrusive-ajax.min.js │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ └── modernizr-2.5.3.js │ ├── Views │ │ ├── Account │ │ │ ├── ChangePassword.aspx │ │ │ ├── ChangePasswordSuccess.aspx │ │ │ ├── LogOn.aspx │ │ │ └── Register.aspx │ │ ├── Home │ │ │ ├── About.aspx │ │ │ └── Index.aspx │ │ ├── Shared │ │ │ ├── Error.aspx │ │ │ ├── LogOnUserControl.ascx │ │ │ └── Site.Master │ │ └── Web.config │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── packages.config ├── DDDPPP.Chap20.CommandHandler.sln ├── PPPDDD.ApplicationServices.Gambling │ ├── App_Start │ │ └── RouteConfig.cs │ ├── ApplicationServices │ │ ├── 1_validation │ │ │ └── RecommendAFriendService.cs │ │ ├── 2_transaction │ │ │ └── RecommendAFriendService.cs │ │ ├── 3_error_handling │ │ │ └── RecommendAFriendService.cs │ │ ├── 4_logging_metrics │ │ │ └── RecommendAFriendService.cs │ │ ├── 5_authentication │ │ │ └── AdminRecommendAFriendService.cs │ │ ├── 6_communication │ │ │ └── RecommendAFriendService.cs │ │ ├── AsyncAwait │ │ │ └── RecommendAFriend.cs │ │ ├── CommandProcessor │ │ │ ├── BloatedRecommendAFriendService.cs │ │ │ └── RecommendAFriend.cs │ │ ├── CommandProcessorChained │ │ │ └── RecommendAFriend.cs │ │ ├── FrameworkHooks │ │ │ ├── ErrorFilter.cs │ │ │ └── TransactionFilter.cs │ │ ├── PublishSubscribe │ │ │ └── RecommendAFriend.cs │ │ ├── PublishSubscribeAsync │ │ │ └── ReferAFriend.cs │ │ └── RequestReply │ │ │ └── RecommendAFriend.cs │ ├── Controllers │ │ └── RecommendAFriendController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── PPPDDD.ApplicationServices.RecommendAFriend.csproj │ ├── PPPDDD.ApplicationServices.RecommendAFriend.sln │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Views │ │ └── web.config │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── packages.config ├── PPPDDD.ApplicationServices.RecommendAFriend.sln └── PPPDDD.ApplicationServices.Tests │ ├── Properties │ └── AssemblyInfo.cs │ ├── Refer_a_friend.cs │ ├── Tests.csproj │ └── packages.config ├── 26 - Queries Domain Reporting ├── PPPDDD.Reporting.sln ├── PPPDDD.Reporting │ ├── App_Start │ │ └── RouteConfig.cs │ ├── Controllers │ │ ├── DealershipPerformanceReportController.cs │ │ ├── DealershipReportUsingMediatorController.cs │ │ ├── DenormalizedLoyaltyReportController.cs │ │ ├── HealthcareEventProjectionReportController.cs │ │ └── LoyaltyReportQueryingDatastoreController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── PPPDDD.Reporting.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Views │ │ └── web.config │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── packages.config ├── README.md └── SportsStoreDatabase │ ├── LoyaltyAccounts.sql │ ├── LoyaltySettings.sql │ ├── Orders.sql │ ├── TestData.sql │ ├── Users.sql │ └── sportsstoredatabase.sqlproj ├── README.md └── eBidder Case Study └── README.md /05 - Domain Model Implementation Patterns/PPPDDDChap05.DomainModel/PPPDDDChap05.DomainModel/Model/HistoricalBid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap05.DomainModel.Model 8 | { 9 | public class HistoricalBid 10 | { 11 | public HistoricalBid(Guid bidder, Money Bid, DateTime timeOfBid) 12 | { 13 | 14 | } 15 | 16 | 17 | public Guid Bidder {get; set;} 18 | public Money Amount {get; set;} 19 | public DateTime TimeOfBid { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.DomainModel/PPPDDDChap05.DomainModel/Model/IAuctionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap05.DomainModel.Model 4 | { 5 | public interface IAuctionRepository 6 | { 7 | void Add(Auction item); 8 | Auction FindBy(Guid Id); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TableModule/PPPDDDChap05.TableModule/Domain/Customers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap05.TableModule.Domain 8 | { 9 | public class Customers 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TableModule/PPPDDDChap05.TableModule/Domain/Orders.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Data; 7 | 8 | namespace PPPDDDChap05.TableModule.Domain 9 | { 10 | public class Orders 11 | { 12 | 13 | public Orders(DataSet dataSet) 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TableModule/PPPDDDChap05.TableModule/Domain/TableModuleBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap05.TableModule.Domain 8 | { 9 | public class TableModuleBase 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TransactionScript/PPPDDDChap05.TransactionScript/Domain/Auction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap05.TransactionScript.Domain 4 | { 5 | public class Auction 6 | { 7 | public Guid Id { get; set; } 8 | public Guid ListingId { get; set; } 9 | public DateTime EndsAt { get; set; } 10 | public decimal StartingPrice { get; set; } 11 | public decimal WinningBid { get; set; } 12 | public decimal WinninBidderMaximumBid { get; set; } 13 | public Guid WinningBidder { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TransactionScript/PPPDDDChap05.TransactionScript/Domain/BidOnAuction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap05.TransactionScript.Domain 8 | { 9 | public class BidOnAuction: ICommand 10 | { 11 | public void Execute() 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TransactionScript/PPPDDDChap05.TransactionScript/Domain/CreateAuction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap05.TransactionScript.Domain 8 | { 9 | public class CreateAuction : ICommand 10 | { 11 | public void Execute() 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /05 - Domain Model Implementation Patterns/PPPDDDChap05.TransactionScript/PPPDDDChap05.TransactionScript/Domain/ICommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap05.TransactionScript.Domain 8 | { 9 | public interface ICommand 10 | { 11 | public void Execute(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/BasketItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 8 | { 9 | public class BasketItem 10 | { 11 | public Quantity quantity() 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | internal void increase_item_quantity_by(Quantity quantity) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/BasketItemFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 8 | { 9 | public class BasketItemFactory 10 | { 11 | internal static BasketItem create_item_for(Product product, basket basket) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/BasketItems.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 8 | { 9 | public class BasketItems : List 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/Country.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 7 | { 8 | public class Country 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/OverSeasSellingPolicyException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 7 | { 8 | class OverSeasSellingPolicyException : Exception 9 | { 10 | public OverSeasSellingPolicyException(string message) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 8 | { 9 | public class Product 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ExplicitLogic/Model/Quantity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ExplicitLogic.Model 8 | { 9 | public class Quantity 10 | { 11 | public Quantity(int p) 12 | { 13 | } 14 | 15 | public Quantity add(Quantity quantity) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | 20 | internal bool contains_more_than(Quantity quantity_threshold) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ImplicitLogic/Model/BasketItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ImplicitLogic.Model 8 | { 9 | public class BasketItem 10 | { 11 | public Quantity quantity() 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | internal void increase_item_quantity_by(Quantity quantity) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ImplicitLogic/Model/BasketItemFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ImplicitLogic.Model 8 | { 9 | public class BasketItemFactory 10 | { 11 | internal static BasketItem create_item_for(Product product, basket basket) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ImplicitLogic/Model/BasketItems.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ImplicitLogic.Model 8 | { 9 | public class BasketItems : List 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ImplicitLogic/Model/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ImplicitLogic.Model 8 | { 9 | public class Product 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /10 - Applying the Principles, Practices and Patterns of DDD/PPPDDD.Chap10.ecommerce/PPPDDD.Chap10.ecommerce/ImplicitLogic/Model/Quantity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDD.Chap10.ecommerce.ImplicitLogic.Model 8 | { 9 | public class Quantity 10 | { 11 | public Quantity(int p) 12 | { 13 | } 14 | 15 | public Quantity add(Quantity quantity) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | 20 | internal bool contains_more_than(Quantity quantity_threshold) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /11 - Integrating Bounded Contexts/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | There is no sample code for chapter 11. This chapter contains theory and 5 | case-studies of integrating bounded contexts and team in distributed domain 6 | driven design (DDDD) environments. 7 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Billing.Messages/Commands/RecordPaymentAttempt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Billing.Messages.Commands 4 | { 5 | public class RecordPaymentAttempt 6 | { 7 | public string OrderId { get; set; } 8 | public PaymentStatus Status { get; set; } 9 | } 10 | 11 | public enum PaymentStatus 12 | { 13 | Accepted, 14 | Rejected 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Billing.Messages/Events/PaymentAccepted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Billing.Messages.Events 4 | { 5 | public class PaymentAccepted 6 | { 7 | public string OrderId { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Billing.Payments.PaymentAccepted/EndpointConfig.cs: -------------------------------------------------------------------------------- 1 | using NServiceBus; 2 | namespace Billing.Payments.PaymentAccepted 3 | { 4 | public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization, AsA_Publisher 5 | { 6 | public void Init() 7 | { 8 | Configure.With() 9 | .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.Contains("Commands")) 10 | .DefiningEventsAs(t => t.Namespace != null && t.Namespace.Contains("Events")); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Billing.Payments.PaymentAccepted/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/DDDesign.Web/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace DDDesign.Web 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/DDDesign.Web/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace DDDesign.Web 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/DDDesign.Web/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace DDDesign.Web 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | config.Routes.MapHttpRoute( 13 | name: "DefaultApi", 14 | routeTemplate: "api/{controller}/{id}", 15 | defaults: new { id = RouteParameter.Optional } 16 | ); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/DDDesign.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="DDDesign.Web.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/DDDesign.Web/Views/Orders/Index.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Place an order 5 | 6 | 7 |

Place an order

8 |
9 |

10 | UserId: 11 |

12 |

13 | ProductIds: 14 |

15 |

16 | ShippingTypeId: 17 |

18 | 19 |
20 | 21 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Promotions.LuckyWinner.LuckyWinnerSelected.Bridge/Infrastructure/EndpointConfig.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Promotions.LuckyWinner.LuckyWinnerSelected.Bridge 3 | { 4 | using NServiceBus; 5 | 6 | public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization, AsA_Publisher 7 | { 8 | public void Init() 9 | { 10 | Configure.With() 11 | .DefiningCommandsAs(t => t.Namespace != null 12 | && t.Namespace.Contains("Commands")) 13 | .DefiningEventsAs(t => t.Namespace != null && t.Namespace.Contains("Events")); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Promotions.LuckyWinner.LuckyWinnerSelected.Bridge/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Promotions.LuckyWinner.LuckyWinnerSelected/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Promotions.LuckyWinner.LuckyWinnerSelected/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | See chapter 12 in the book for guidance on setting up and running this project, 5 | including NServiceBus and MSMQ installation instructions. 6 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Sales.Messages/Commands/PlaceOrder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Sales.Messages.Commands 8 | { 9 | public class PlaceOrder 10 | { 11 | public string UserId { get; set; } 12 | 13 | public string[] ProductIds { get; set; } 14 | 15 | public string ShippingTypeId { get; set;} 16 | 17 | public DateTime TimeStamp { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Sales.Messages/Events/OrderCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Sales.Messages.Events 5 | { 6 | public class OrderCreated 7 | { 8 | public string OrderId { get; set; } 9 | 10 | public string UserId { get; set; } 11 | 12 | public string[] ProductIds { get; set; } 13 | 14 | public string ShippingTypeId { get; set; } 15 | 16 | public DateTime TimeStamp { get; set; } 17 | 18 | public double Amount { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Sales.Messages/Events/OrderCreated_V2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Sales.Messages.Events 4 | { 5 | public class OrderCreated_V2 : OrderCreated 6 | { 7 | public string AddressId { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Sales.Orders.OrderCreated/Infrastructure/EndpointConfig.cs: -------------------------------------------------------------------------------- 1 | using NServiceBus; 2 | 3 | namespace Sales.Orders.OrderCreated 4 | { 5 | public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization, AsA_Publisher 6 | { 7 | public void Init() 8 | { 9 | Configure.With() 10 | .DefiningCommandsAs(t => t.Namespace != null 11 | && t.Namespace.Contains("Commands")) 12 | .DefiningEventsAs(t => t.Namespace != null 13 | && t.Namespace.Contains("Events")); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Sales.Orders.OrderCreated/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Shipping.BusinessCustomers.ShippingArranged/Infrastructure/EndpointConfig.cs: -------------------------------------------------------------------------------- 1 | using NServiceBus; 2 | 3 | namespace Shipping.BusinessCustomers.ShippingArranged 4 | { 5 | public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, AsA_Publisher, IWantCustomInitialization 6 | { 7 | public void Init() 8 | { 9 | Configure.With() 10 | .DefiningCommandsAs(t => t.Namespace != null 11 | && t.Namespace.Contains("Commands")) 12 | .DefiningEventsAs(t => t.Namespace != null 13 | && t.Namespace.Contains("Events")); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Shipping.BusinessCustomers.ShippingArranged/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /12 - Integrating Via Messaging/Shipping.Messages/Events/ShippingArranged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Shipping.Messages.Events 4 | { 5 | public class ShippingArranged 6 | { 7 | public string OrderId { get; set; } 8 | 9 | /* 10 | * Other fields, such as date/date range 11 | * could be added here depending on your 12 | * shipping provider(s) API 13 | */ 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/AccountManagement/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace AccountManagement 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | // Web API configuration and services 13 | 14 | // Web API routes 15 | config.MapHttpAttributeRoutes(); 16 | 17 | config.Routes.MapHttpRoute( 18 | name: "DefaultApi", 19 | routeTemplate: "api/{controller}/{id}", 20 | defaults: new { id = RouteParameter.Optional } 21 | ); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/AccountManagement/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="AccountManagement.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/AccountManagement/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Http; 6 | using System.Web.Routing; 7 | 8 | namespace AccountManagement 9 | { 10 | public class WebApiApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | GlobalConfiguration.Configure(WebApiConfig.Register); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/AccountManagement/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/Discovery/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace Discovery 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | // Web API configuration and services 13 | 14 | // Web API routes 15 | config.MapHttpAttributeRoutes(); 16 | 17 | config.Routes.MapHttpRoute( 18 | name: "DefaultApi", 19 | routeTemplate: "api/{controller}/{id}", 20 | defaults: new { id = RouteParameter.Optional } 21 | ); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/Discovery/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Discovery.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/Discovery/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Http; 6 | using System.Web.Routing; 7 | 8 | namespace Discovery 9 | { 10 | public class WebApiApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | GlobalConfiguration.Configure(WebApiConfig.Register); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.JSON.SocialMedia/Discovery/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.Accounts.Api/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="AccountManagement.Accounts.Api.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Http; 3 | 4 | namespace AccountManagement.EntryPoint.Api 5 | { 6 | public static class WebApiConfig 7 | { 8 | public static void Register(HttpConfiguration config) 9 | { 10 | config.MapHttpAttributeRoutes(); 11 | 12 | config.Routes.MapHttpRoute( 13 | name: "Entry Point", 14 | routeTemplate: "accountmanagement", 15 | defaults: new { controller = "EntryPoint", action = "Get" } 16 | ); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="AccountManagement.EntryPoint.Api.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/js/hal/views/documentation.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Documenation = Backbone.View.extend({ 2 | className: 'documentation', 3 | 4 | render: function(url) { 5 | this.$el.html(''); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/js/hal/views/explorer.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Explorer = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | var self = this; 4 | this.vent = opts.vent; 5 | this.navigationView = new HAL.Views.Navigation({ vent: this.vent }); 6 | this.resourceView = new HAL.Views.Resource({ vent: this.vent }); 7 | }, 8 | 9 | className: 'explorer span6', 10 | 11 | render: function() { 12 | this.navigationView.render(); 13 | 14 | this.$el.html(this.template()); 15 | 16 | this.$el.append(this.navigationView.el); 17 | this.$el.append(this.resourceView.el); 18 | }, 19 | 20 | template: function() { 21 | return '

Explorer

'; 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/js/hal/views/navigation.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Navigation = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | this.locationBar = new HAL.Views.LocationBar({ vent: this.vent }); 5 | this.requestHeadersView = new HAL.Views.RequestHeaders({ vent: this.vent }); 6 | }, 7 | 8 | className: 'navigation', 9 | 10 | render: function() { 11 | this.$el.empty(); 12 | 13 | this.locationBar.render(); 14 | this.requestHeadersView.render(); 15 | 16 | this.$el.append(this.locationBar.el); 17 | this.$el.append(this.requestHeadersView.el); 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/js/hal/views/properties.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Properties = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | _.bindAll(this, 'render'); 5 | }, 6 | 7 | className: 'properties', 8 | 9 | render: function(props) { 10 | this.$el.html(this.template({ properties: props })); 11 | }, 12 | 13 | template: _.template($('#properties-template').html()) 14 | }); 15 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/js/hal/views/response.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Response = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | 5 | this.headersView = new HAL.Views.ResponseHeaders({ vent: this.vent }); 6 | this.bodyView = new HAL.Views.ResponseBody({ vent: this.vent }); 7 | 8 | _.bindAll(this, 'render'); 9 | 10 | this.vent.bind('response', this.render); 11 | }, 12 | 13 | className: 'response', 14 | 15 | render: function(e) { 16 | this.$el.html(); 17 | 18 | this.headersView.render(e); 19 | this.bodyView.render(e); 20 | 21 | this.$el.append(this.headersView.el); 22 | this.$el.append(this.bodyView.el); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/js/hal/views/response_headers.js: -------------------------------------------------------------------------------- 1 | HAL.Views.ResponseHeaders = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | }, 5 | 6 | className: 'response-headers', 7 | 8 | render: function(e) { 9 | this.$el.html(this.template({ 10 | status: { 11 | code: e.jqxhr.status, 12 | text: e.jqxhr.statusText 13 | }, 14 | headers: e.jqxhr.getAllResponseHeaders() 15 | })); 16 | }, 17 | 18 | template: _.template($('#response-headers-template').html()) 19 | }); 20 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/vendor/img/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/vendor/img/ajax-loader.gif -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/vendor/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/vendor/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/vendor/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.EntryPoint/vendor/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.RegularAccounts.BeganFollowing/App_Start/EnableCorsAttribute.cs: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.RegularAccounts.BeganFollowing/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="AccountManagement.RegularAccounts.BeganFollowing.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/AccountManagement.RegularAccounts.BeganFollowing/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Http; 6 | using System.Web.Routing; 7 | 8 | namespace AccountManagement.RegularAccounts.BeganFollowing 9 | { 10 | public class WebApiApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | GlobalConfiguration.Configure(WebApiConfig.Register); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.REST.SocialMedia/Discovery.Reccommendations.Followers/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/AccountManagement/FollowerDirectory.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="AccountManagement.FollowerDirectory" CodeBehind="FollowerDirectory.svc.cs" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/AccountManagement/IFollowerDirectory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.Serialization; 4 | using System.ServiceModel; 5 | 6 | namespace AccountManagement 7 | { 8 | [ServiceContract] 9 | public interface IFollowerDirectory 10 | { 11 | [OperationContract] 12 | List FindUsersFollowers(string accountId); 13 | } 14 | 15 | public class Follower 16 | { 17 | public string FollowerId { get; set; } 18 | 19 | public string FollowerName { get; set; } 20 | 21 | public List SocialTags { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/Discovery/IRecommender.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.Serialization; 4 | using System.ServiceModel; 5 | 6 | namespace Discovery 7 | { 8 | [ServiceContract] 9 | public interface IRecommender 10 | { 11 | [OperationContract] 12 | List GetRecommendedUsers(string accountId); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/Discovery/Recommender.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="Discovery.Recommender" CodeBehind="Recommender.svc.cs" %> 2 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/Discovery/Service References/AccountManagement/Discovery.AccountManagement.Follower.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | Discovery.AccountManagement.Follower, Service References.AccountManagement.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/Discovery/Service References/AccountManagement/FollowerDirectory.disco: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/PPPDDD.SOAP.SocialMedia/Discovery/Service References/AccountManagement/FollowerDirectory2.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /13 - Integrating Via Http and Rest/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /14 - Introducing Domain Modelling Patterns and Best Practices/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /15 - Value Objects/Examples/BankAccount/BankAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Examples.BankAccount 8 | { 9 | // Entity 10 | public class BankAccount 11 | { 12 | public BankAccount(Guid id) 13 | { 14 | this.Id = id; 15 | } 16 | 17 | public Guid Id { get; private set; } 18 | 19 | public Money Balance { get; private set; } 20 | 21 | // ... 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /15 - Value Objects/Examples/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /15 - Value Objects/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /15 - Value Objects/Tests/Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /16 - Entities/PPPDDDChap17.Entities.Examples/Model/GlobalCounter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap17.Entities.Examples 8 | { 9 | public static class RandomEntityFactory 10 | { 11 | private static long lastId = 0; 12 | 13 | public static RandomEntity CreateEntity() 14 | { 15 | return new RandomEntity(++lastId); 16 | } 17 | } 18 | 19 | public class RandomEntity 20 | { 21 | public RandomEntity(long Id) 22 | { 23 | this.Id = Id; 24 | } 25 | 26 | public long Id { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /16 - Entities/PPPDDDChap17.Entities.Examples/Model/Vehicle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap17.Entities.Examples 8 | { 9 | // Factory used for example - not mandatory 10 | public static class VehicleFactory 11 | { 12 | public static Vehicle CreateVehicle() 13 | { 14 | var id = Guid.NewGuid(); 15 | return new Vehicle(id); 16 | } 17 | } 18 | 19 | public class Vehicle 20 | { 21 | public Vehicle(Guid id) 22 | { 23 | this.Id = id; 24 | } 25 | 26 | public Guid Id { get; private set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /16 - Entities/PPPDDDChap17.Entities.Examples/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /16 - Entities/PPPDDDChap17.Entities.Tests/BookTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using PPPDDDChap17.Entities.Examples; 4 | 5 | namespace PPPDDDChap17.Entities.Tests 6 | { 7 | [TestClass] 8 | public class BookTests 9 | { 10 | [TestMethod] 11 | public void Books_identity_is_its_ISBN() 12 | { 13 | var isbnForThisBook = "9781118714706"; 14 | var isbn = new ISBN(isbnForThisBook); 15 | 16 | var book = new Book(isbn); 17 | 18 | Assert.AreEqual(isbn, book.ISBN); 19 | Assert.AreEqual(isbnForThisBook, book.Id); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /16 - Entities/PPPDDDChap17.Entities.Tests/GlobalCounterTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using PPPDDDChap17.Entities.Examples; 4 | 5 | namespace PPPDDDChap17.Entities.Tests 6 | { 7 | [TestClass] 8 | public class GlobalCounterTest 9 | { 10 | [TestMethod] 11 | public void Each_new_entity_gets_the_next_sequential_Id() 12 | { 13 | var entity1 = RandomEntityFactory.CreateEntity(); 14 | var entity2 = RandomEntityFactory.CreateEntity(); 15 | var entity3 = RandomEntityFactory.CreateEntity(); 16 | 17 | Assert.AreEqual(1, entity1.Id); 18 | Assert.AreEqual(2, entity2.Id); 19 | Assert.AreEqual(3, entity3.Id); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /16 - Entities/PPPDDDChap17.Entities.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /16 - Entities/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Insurance/Model/IMemberRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Insurance.Model 8 | { 9 | public interface IMemberRepository 10 | { 11 | IEnumerable Get(IEnumerable memberIds); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Insurance/Model/IMultiMemberPremiumCalculator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Insurance.Model 8 | { 9 | // Domain Service interface 10 | public interface IMultiMemberPremiumCalculator 11 | { 12 | Quote CalculatePremium(Policy mainPolicy, IEnumerable additionalMembers); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Insurance/Model/IPolicyRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Insurance.Model 8 | { 9 | public interface IPolicyRepository 10 | { 11 | Policy Get(int policyId); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Insurance/Model/Member.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Insurance.Model 8 | { 9 | public class Member 10 | { 11 | public Guid Id { get; protected set; } 12 | 13 | // ... 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Insurance/Model/Policy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Insurance.Model 8 | { 9 | public class Policy 10 | { 11 | public Guid Id { get; protected set; } 12 | 13 | // ... 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Insurance/Model/Quote.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Insurance.Model 8 | { 9 | public class Quote 10 | { 11 | // ... 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineDating/Model/BloodType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineDating.Model 8 | { 9 | // value object 10 | public class BloodType 11 | { 12 | // ... 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineDating/Model/CompatibilityRating.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineDating.Model 8 | { 9 | public class CompatibilityRating 10 | { 11 | public CompatibilityRating Boost(CompatibilityRating rating) 12 | { 13 | // .. 14 | return null; 15 | } 16 | 17 | // .. 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineDating/Model/LoveSeeker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineDating.Model 8 | { 9 | // entity 10 | public class LoveSeeker 11 | { 12 | public Guid Id { get; protected set; } 13 | 14 | public BloodType BloodType { get; private set; } 15 | 16 | // ... 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/Competitor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | public class Competitor 10 | { 11 | public Guid Id { get; protected set; } 12 | 13 | public string GamerTag { get; protected set; } 14 | 15 | public Score Score { get; set; } 16 | 17 | public Ranking WorldRanking { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/IGame.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | public interface IGame 10 | { 11 | IEnumerable Winners { get; } 12 | 13 | IEnumerable Losers { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/IGameRewardPolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | // Domain Service interface - part of ubiquitous language 10 | public interface IGamingRewardPolicy 11 | { 12 | void Apply(IGame game); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/IGameScoringPolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | // Domain Service interface - part of ubiquitous language 10 | public interface IGamingScorePolicy 11 | { 12 | void Apply(IGame game); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/IScoreFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | // repository 10 | public interface IScoreFinder 11 | { 12 | Score FindTopScore(IGame game, int resultNumber); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/Ranking.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | public class Ranking 10 | { 11 | // ... 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithDomainServices/Model/Score.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithDomainServices.Model 8 | { 9 | public class Score 10 | { 11 | public int Value { get; private set; } 12 | 13 | public Score(int value) 14 | { 15 | this.Value = value; 16 | } 17 | 18 | public Score Add(Score amount) 19 | { 20 | return new Score(this.Value + amount.Value); 21 | } 22 | 23 | public Score Subtract(Score amount) 24 | { 25 | return new Score(this.Value - amount.Value); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithoutDomainServices/Model/Competitor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithoutDomainServices.Model 8 | { 9 | public class Competitor 10 | { 11 | public Guid Id { get; protected set; } 12 | 13 | public string GamerTag { get; protected set; } 14 | 15 | public Score Score { get; set; } 16 | 17 | public Ranking WorldRanking { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithoutDomainServices/Model/Ranking.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithoutDomainServices.Model 8 | { 9 | public class Ranking 10 | { 11 | // ... 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/OnlineGaming/WithoutDomainServices/Model/Score.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.OnlineGaming.WithoutDomainServices.Model 8 | { 9 | public class Score 10 | { 11 | public int Value { get; private set; } 12 | 13 | public Score(int value) 14 | { 15 | this.Value = value; 16 | } 17 | 18 | public Score Add(Score amount) 19 | { 20 | return new Score(this.Value + amount.Value); 21 | } 22 | 23 | public Score Subtract(Score amount) 24 | { 25 | return new Score(this.Value - amount.Value); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/RestaurantBooking/Model/BookingDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.RestaurantBooking.Model 8 | { 9 | // value object 10 | public class BookingDetails 11 | { 12 | public DateTime When { get; private set; } 13 | 14 | public int NumberOfDiners { get; private set; } 15 | 16 | // ... 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/RestaurantBooking/Model/Customer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.RestaurantBooking.Model 8 | { 9 | // Entity 10 | public class Customer 11 | { 12 | public Guid Id { get; protected set; } 13 | 14 | // .. 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/RestaurantBooking/Model/IHandleEvents.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.RestaurantBooking.Model 8 | { 9 | interface IHandleEvents 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/RestaurantBooking/Model/Restaurant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.RestaurantBooking.Model 8 | { 9 | // Entity 10 | public class Restaurant 11 | { 12 | public Guid Id { get; protected set; } 13 | 14 | // .. 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /17 - Domain Services/PPPDDDChap18.DomainServices/Shipping/Model/IShippingRouteFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap18.DomainServices.Shipping.Model 8 | { 9 | // interface for Domain Service - this would live in the Domain Model 10 | // this is the "contract" 11 | public interface IShippingRouteFinder 12 | { 13 | Route FindFastestRoute(Location departing, Location destination, DateTime departureDate); 14 | } 15 | 16 | public class Route 17 | { 18 | // ... 19 | } 20 | 21 | public class Location 22 | { 23 | // ... 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /17 - Domain Services/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /18 - Domain Events/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /18 - Domain Events/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/18 - Domain Events/.nuget/NuGet.exe -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NServiceBus/Application/Events/RefundDueToLateDelivery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NativeEvents.Application.Events 8 | { 9 | public class RefundDueToLateDelivery 10 | { 11 | public Guid OrderId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NServiceBus/Model/Events/DeliveryGuaranteeFailed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NServiceBus.Model.Events 8 | { 9 | public class DeliveryGuaranteeFailed 10 | { 11 | public DeliveryGuaranteeFailed(OrderForDelivery order) 12 | { 13 | Order = order; 14 | } 15 | 16 | public OrderForDelivery Order { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NServiceBus/Model/FoodDeliveryOrderSteps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NServiceBus.Model 8 | { 9 | enum FoodDeliveryOrderSteps 10 | { 11 | Pending, 12 | Delivered 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NServiceBus/Model/IDeliveryGuaranteeOffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NServiceBus.Model 8 | { 9 | public interface IDeliveryGuaranteeOffer 10 | { 11 | bool IsNotSatisfiedBy(DateTime timeOfOrderBeingPlaced, DateTime timeThatPizzaWasDelivered); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NServiceBus/Model/IOrderRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NServiceBus.Model 8 | { 9 | public interface IOrderRepository 10 | { 11 | OrderForDelivery FindBy(Guid id); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NServiceBus/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NativeEvents/Application/Events/RefundDueToLateDelivery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NativeEvents.Application.Events 8 | { 9 | public class RefundDueToLateDelivery 10 | { 11 | public Guid OrderId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NativeEvents/Model/Events/DeliveryGuaranteeFailed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NativeEvents.Model.Events 8 | { 9 | public class DeliveryGuaranteeFailed 10 | { 11 | public DeliveryGuaranteeFailed(OrderForDelivery order) 12 | { 13 | Order = order; 14 | } 15 | 16 | public OrderForDelivery Order { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NativeEvents/Model/FoodDeliveryOrderSteps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NativeEvents.Model 8 | { 9 | enum FoodDeliveryOrderSteps 10 | { 11 | Pending, 12 | Delivered 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NativeEvents/Model/IDeliveryGuaranteeOffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NativeEvents.Model 8 | { 9 | public interface IDeliveryGuaranteeOffer 10 | { 11 | bool IsNotSatisfiedBy(DateTime timeOfOrderBeingPlaced, DateTime timeThatPizzaWasDelivered); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NativeEvents/Model/IOrderRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.NativeEvents.Model 8 | { 9 | public interface IOrderRepository 10 | { 11 | OrderForDelivery FindBy(Guid id); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.NativeEvents/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.ReturnEvents/Infrastructure/IEventDispatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.ReturnEvents.Infrastructure 8 | { 9 | public interface IEventDispatcher 10 | { 11 | void Dispatch (T evnt); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.ReturnEvents/Model/Events/DeliveryGuaranteeFailed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.ReturnEvents.Model.Events 8 | { 9 | public class DeliveryGuaranteeFailed 10 | { 11 | public DeliveryGuaranteeFailed(OrderForDelivery order) 12 | { 13 | Order = order; 14 | } 15 | 16 | public OrderForDelivery Order { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.ReturnEvents/Model/FoodDeliveryOrderSteps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.ReturnEvents.Model 8 | { 9 | enum FoodDeliveryOrderSteps 10 | { 11 | Pending, 12 | Delivered 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.ReturnEvents/Model/IDeliveryGuaranteeOffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.ReturnEvents.Model 8 | { 9 | public interface IDeliveryGuaranteeOffer 10 | { 11 | bool IsNotSatisfiedBy(DateTime timeOfOrderBeingPlaced, DateTime timeThatPizzaWasDelivered); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.ReturnEvents/Model/IOrderRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.ReturnEvents.Model 8 | { 9 | public interface IOrderRepository 10 | { 11 | OrderForDelivery FindBy(Guid id); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.StaticDomainEvents/Application/Events/RefundDueToLateDelivery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.StaticDomainEvents.Application.Events 8 | { 9 | public class RefundDueToLateDelivery 10 | { 11 | public Guid OrderId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.StaticDomainEvents/Model/Events/DeliveryGuaranteeFailed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.StaticDomainEvents.Model.Events 8 | { 9 | public class DeliveryGuaranteeFailed 10 | { 11 | public DeliveryGuaranteeFailed(OrderForDelivery order) 12 | { 13 | Order = order; 14 | } 15 | 16 | public OrderForDelivery Order { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.StaticDomainEvents/Model/FoodDeliveryOrderSteps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.StaticDomainEvents.Model 8 | { 9 | enum FoodDeliveryOrderSteps 10 | { 11 | Pending, 12 | Delivered 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.StaticDomainEvents/Model/IDeliveryGuaranteeOffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.StaticDomainEvents.Model 8 | { 9 | public interface IDeliveryGuaranteeOffer 10 | { 11 | bool IsNotSatisfiedBy(DateTime timeOfOrderBeingPlaced, DateTime timeThatPizzaWasDelivered); 12 | } 13 | 14 | public class ThirtyMinuteDeliveryGuaranteeOffer : IDeliveryGuaranteeOffer 15 | { 16 | public bool IsNotSatisfiedBy(DateTime timeOfOrderBeingPlaced, DateTime timeThatPizzaWasDelivered) 17 | { 18 | return (timeThatPizzaWasDelivered - timeOfOrderBeingPlaced) > TimeSpan.FromMinutes(30); 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.StaticDomainEvents/Model/IOrderRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineTakeawayStore.StaticDomainEvents.Model 8 | { 9 | public interface IOrderRepository 10 | { 11 | OrderForDelivery FindBy(Guid id); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.StaticDomainEvents/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /18 - Domain Events/OnlineTakeawayStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Disputes/_ReadMe.txt: -------------------------------------------------------------------------------- 1 | This project would hold the code for eBidders dispute system. -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Application/Auctions/BusinessUseCases/AuctionCreation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Application.Application.BusinessUseCases 4 | { 5 | public class AuctionCreation 6 | { 7 | public decimal StartingPrice { get; set; } 8 | public Guid SellerId { get; set; } 9 | public DateTime EndsAt { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Application/QandA/BusinessUseCases/Answer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Application.QandA.BusinessUseCases 8 | { 9 | public class Answer 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Application/Watching/BusinessUseCases/UnWatchItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Application.Watching.BusinessUseCases 8 | { 9 | public class UnWatchItem 10 | { 11 | public Guid MemberId { get; set; } 12 | public Guid WatchedItemId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Application/Watching/BusinessUseCases/WatchItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Application.Watching.BusinessUseCases 8 | { 9 | public class WatchItem 10 | { 11 | public Guid MemberId { get; set; } 12 | public Guid AuctionId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | namespace PPPDDDChap19.eBidder.Listings.Application.Infrastructure 2 | { 3 | public abstract class Entity 4 | { 5 | public TId Id { get; protected set; } 6 | public int Version { get; private set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Application.Infrastructure 4 | { 5 | public interface IClock 6 | { 7 | DateTime Time(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Application.Infrastructure 4 | { 5 | public class SystemClock : IClock 6 | { 7 | public DateTime Time() 8 | { 9 | return DateTime.Now; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/ListingFormat/Auctions/AuctionId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.ListingFormat.Auctions 8 | { 9 | public class AuctionId 10 | { 11 | public AuctionId(Guid id) 12 | { 13 | Id = id; 14 | } 15 | 16 | public Guid Id { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/ListingFormat/Auctions/BidHistory/IBidHistoryRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Model.Auctions.BidHistory 4 | { 5 | public interface IBidHistoryRepository 6 | { 7 | int NoOfBidsFor(Guid autionId); 8 | void Add(Bid bid); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/ListingFormat/Auctions/IAuctionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Model.Auctions 4 | { 5 | public interface IAuctionRepository 6 | { 7 | void Add(Auction item); 8 | Auction FindBy(Guid Id); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/ListingFormat/Auctions/OutBid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Model.Auctions 4 | { 5 | public class OutBid 6 | { 7 | public OutBid(Guid auctionId, Guid bidderId) 8 | { 9 | if (auctionId == Guid.Empty) 10 | throw new ArgumentNullException("Auction Id cannot be null"); 11 | 12 | if (bidderId == Guid.Empty) 13 | throw new ArgumentNullException("Bidder Id cannot be null"); 14 | 15 | AuctionId = auctionId; 16 | Bidder = bidderId; 17 | } 18 | 19 | public Guid AuctionId { get; private set; } 20 | public Guid Bidder { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/ListingFormat/FixedPriceListings/IFixedPriceListingRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.FixedPrice 8 | { 9 | public interface IFixedPriceListingRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/ListingFormat/FixedPriceListings/Offers/BestOffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Auctions.Offers 8 | { 9 | public class BestOffer 10 | { 11 | public void CounterOffer() 12 | { 13 | //price and terms, and click 'Send'. 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Listings/FormatType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Listings 8 | { 9 | public enum FormatType 10 | { 11 | Auction, 12 | FixedPrice 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Listings/IListingRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Listings 8 | { 9 | public interface IListingRepository 10 | { 11 | void Add(Listing listing); 12 | Listing FindBy(Guid id); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Listings/ListingFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Listings 8 | { 9 | public class ListingFormat 10 | { 11 | public ListingFormat(Guid formatId, FormatType format) 12 | { 13 | FormatId = formatId; 14 | Format = format; 15 | } 16 | 17 | public Guid FormatId { get; private set; } 18 | public FormatType Format { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Listings/ListingRevision.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Listings 8 | { 9 | public class ListingRevision 10 | { 11 | private Guid Item { get; set; } 12 | private DateTime Date { get; set; } 13 | private String RevisedInformation { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Listings/ListingRevisionEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Listings 8 | { 9 | public class ListingRevisionEvent 10 | { 11 | private Guid Item { get; set; } 12 | private DateTime Date {get; set;} 13 | 14 | private String RevisedInformation { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Members/IMemberService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Members 8 | { 9 | public interface IMemberService 10 | { 11 | Member GetMember(Guid memberId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Members/Member.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Members 8 | { 9 | public class Member 10 | { 11 | public bool CanBid { get; private set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/MoneyCannotBeANegativeValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Model 4 | { 5 | public class MoneyCannotBeANegativeValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/MoreThanTwoDecimalPlacesInMoneyValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap19.eBidder.Listings.Model 4 | { 5 | public class MoreThanTwoDecimalPlacesInMoneyValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/QandA/Answer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.QandA 8 | { 9 | public class Answer 10 | { 11 | public Answer(DateTime dateAnswered, string text) 12 | { 13 | DateAnswered = dateAnswered; 14 | Text = text; 15 | } 16 | 17 | public DateTime DateAnswered { get; private set; } 18 | public string Text { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/QandA/IQuestionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.QandA 8 | { 9 | public interface IQuestionRepository 10 | { 11 | Question FindBy(Guid id); 12 | void Add(Question question); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Sellers/ISellerService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Sellers 8 | { 9 | public interface ISellerService 10 | { 11 | Seller GetSeller(Guid sellerId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/Sellers/Seller.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Sellers 8 | { 9 | public class Seller 10 | { 11 | 12 | public bool CanList { get; private set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/WatchLists/IWatchedItemRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.WatchLists 8 | { 9 | public interface IWatchedItemRepository 10 | { 11 | WatchedItem FindBy(Guid id); 12 | void Add(WatchedItem watched); 13 | void Remove(WatchedItem watched); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Listings/Model/WatchLists/WatchedItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.WatchLists 8 | { 9 | public class WatchedItem 10 | { 11 | public WatchedItem(Guid id, Guid listingId, Guid memberId) 12 | { 13 | 14 | } 15 | 16 | public Guid Id { get; private set; } 17 | public Guid ListingId { get; private set; } 18 | public Guid MemberId { get; private set; } 19 | 20 | private string Note { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Membership/Model/Members/IMemberRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Members 8 | { 9 | public interface IMemberRepository 10 | { 11 | Member FindBy(Guid memberId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Membership/Model/Members/Member.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap19.eBidder.Listings.Model.Members 8 | { 9 | public class Member 10 | { 11 | private Guid Id { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.Membership/_ReadMe.txt: -------------------------------------------------------------------------------- 1 | This project would hold the code for eBidders seller account. -------------------------------------------------------------------------------- /19 - Aggregates/PPPDDDChap19.eBidder/PPPDDDChap19.eBidder.SellerAccount/_ReadMe.txt: -------------------------------------------------------------------------------- 1 | This project would hold the code for eBidders membership. -------------------------------------------------------------------------------- /19 - Aggregates/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /20 - Factories/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/21 - Repositories/DDDPPP.Chap21.EFExample/.nuget/NuGet.exe -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Application/BusinessUseCases/NewAuctionRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.EFExample.Application.Application.BusinessUseCases 8 | { 9 | public class NewAuctionRequest 10 | { 11 | public decimal StartingPrice { get; set; } 12 | public DateTime EndsAt { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Application/Queries/AuctionStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using DDDPPP.Chap21.EFExample.Application.Model.BidHistory; 7 | 8 | namespace DDDPPP.Chap21.EFExample.Application.Application.Queries 9 | { 10 | public class AuctionStatus 11 | { 12 | public Guid Id { get; set; } 13 | public decimal CurrentPrice { get; set; } 14 | public DateTime AuctionEnds { get; set; } 15 | public Guid WinningBidderId { get; set; } 16 | public int NumberOfBids { get; set; } 17 | public TimeSpan TimeRemaining { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Application/Queries/BidInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.EFExample.Application.Application.Queries 8 | { 9 | public class BidInformation 10 | { 11 | public Guid Bidder { get; set; } 12 | public decimal AmountBid { get; set; } 13 | public string Currency { get; set; } 14 | public DateTime TimeOfBid { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Infrastructure/DataModel/AuctionDTO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DDDPPP.Chap21.EFExample.Application.Infrastructure.DataModel 5 | { 6 | public partial class AuctionDTO 7 | { 8 | public System.Guid Id { get; set; } 9 | public decimal StartingPrice { get; set; } 10 | public DateTime AuctionEnds { get; set; } 11 | 12 | public Nullable BidderMemberId { get; set; } 13 | public System.DateTime? TimeOfBid { get; set; } 14 | public Nullable MaximumBid { get; set; } 15 | public Nullable CurrentPrice { get; set; } 16 | 17 | public int Version { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Infrastructure/DataModel/BidDTO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DDDPPP.Chap21.EFExample.Application.Infrastructure.DataModel 5 | { 6 | public partial class BidDTO 7 | { 8 | public System.Guid Id { get; set; } 9 | public System.Guid AuctionId { get; set; } 10 | public System.Guid BidderId { get; set; } 11 | public decimal Bid { get; set; } 12 | public System.DateTime TimeOfBid { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.EFExample.Application.Infrastructure 4 | { 5 | public abstract class Entity 6 | { 7 | public TId Id { get; protected set; } 8 | public int Version { get; protected set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.EFExample.Application.Infrastructure 8 | { 9 | public interface IClock 10 | { 11 | DateTime Time(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.EFExample.Application.Infrastructure 8 | { 9 | public class SystemClock : IClock 10 | { 11 | public DateTime Time() 12 | { 13 | return DateTime.Now; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/Auction/AuctionSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.EFExample.Application.Model.Auction 4 | { 5 | public class AuctionSnapshot 6 | { 7 | public Guid Id { get; set; } 8 | public decimal StartingPrice { get; set; } 9 | public DateTime EndsAt { get; set; } 10 | public WinningBidSnapshot WinningBid { get; set; } 11 | public int Version { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/Auction/IAuctionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DDDPPP.Chap21.EFExample.Application.Application; 3 | 4 | namespace DDDPPP.Chap21.EFExample.Application.Model.Auction 5 | { 6 | public interface IAuctionRepository 7 | { 8 | void Add(Auction auction); 9 | void Save(Auction auction); 10 | Auction FindBy(Guid Id); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/Auction/MoneyCannotBeANegativeValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.EFExample.Application.Model.Auction 4 | { 5 | public class MoneyCannotBeANegativeValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/Auction/MoneySnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.EFExample.Application.Model.Auction 4 | { 5 | public class MoneySnapshot 6 | { 7 | public decimal Value { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/Auction/MoreThanTwoDecimalPlacesInMoneyValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.EFExample.Application.Model.Auction 4 | { 5 | public class MoreThanTwoDecimalPlacesInMoneyValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/Auction/WinningBidSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.EFExample.Application.Model.Auction 4 | { 5 | public class WinningBidSnapshot 6 | { 7 | public Guid BiddersId { get; set; } 8 | public DateTime TimeOfBid { get; set; } 9 | public decimal BiddersMaximumBid { get; set; } 10 | public decimal CurrentPrice { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/BidHistory/BidHistory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace DDDPPP.Chap21.EFExample.Application.Model.BidHistory 6 | { 7 | public class BidHistory 8 | { 9 | private IEnumerable _bids; 10 | 11 | public BidHistory(IEnumerable bids) 12 | { 13 | if (bids == null) 14 | throw new ArgumentNullException("Bids cannot be null"); 15 | 16 | _bids = bids; 17 | } 18 | 19 | public IEnumerable ShowAllBids() 20 | { 21 | var bids = _bids.OrderByDescending(x => x.AmountBid).ThenBy(x => x.TimeOfBid); 22 | 23 | return bids; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/Model/BidHistory/IBidHistoryRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.EFExample.Application.Model.BidHistory 8 | { 9 | public interface IBidHistoryRepository 10 | { 11 | int NoOfBidsFor(Guid autionId); 12 | void Add(Bid bid); 13 | BidHistory FindBy(Guid auctionId); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Application/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.EFExample/DDDPPP.Chap21.EFExample.Presentation/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/21 - Repositories/DDDPPP.Chap21.MicroORM/.nuget/NuGet.exe -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Application/BusinessUseCases/NewAuctionRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.MicroORM.Application.Application.BusinessUseCases 8 | { 9 | public class NewAuctionRequest 10 | { 11 | public decimal StartingPrice { get; set; } 12 | public DateTime EndsAt { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Application/Queries/AuctionStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using DDDPPP.Chap21.MicroORM.Application.Model.BidHistory; 7 | 8 | namespace DDDPPP.Chap21.MicroORM.Application.Application.Queries 9 | { 10 | public class AuctionStatus 11 | { 12 | public Guid Id { get; set; } 13 | public decimal CurrentPrice { get; set; } 14 | public DateTime AuctionEnds { get; set; } 15 | public Guid WinningBidderId { get; set; } 16 | public int NumberOfBids { get; set; } 17 | public TimeSpan TimeRemaining { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Application/Queries/BidInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.MicroORM.Application.Application.Queries 8 | { 9 | public class BidInformation 10 | { 11 | public Guid Bidder { get; set; } 12 | public decimal AmountBid { get; set; } 13 | public string Currency { get; set; } 14 | public DateTime TimeOfBid { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/ConcurrencyException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 4 | { 5 | public class ConcurrencyException : ApplicationException 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/DataModel/AuctionDTO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure.DataModel 5 | { 6 | public partial class AuctionDTO : IAggregateDataModel 7 | { 8 | public System.Guid Id { get; set; } 9 | public decimal StartingPrice { get; set; } 10 | public DateTime AuctionEnds { get; set; } 11 | 12 | public Nullable BidderMemberId { get; set; } 13 | public System.DateTime? TimeOfBid { get; set; } 14 | public Nullable MaximumBid { get; set; } 15 | public Nullable CurrentPrice { get; set; } 16 | 17 | public int Version { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/DataModel/BidDTO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure.DataModel 5 | { 6 | public partial class BidDTO : IAggregateDataModel 7 | { 8 | public System.Guid Id { get; set; } 9 | public System.Guid AuctionId { get; set; } 10 | public System.Guid BidderId { get; set; } 11 | public decimal Bid { get; set; } 12 | public System.DateTime TimeOfBid { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 5 | { 6 | public abstract class Entity 7 | { 8 | public TId Id { get; protected set; } 9 | public int Version { get; protected set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/IAggregateDataModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 4 | { 5 | public interface IAggregateDataModel 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 8 | { 9 | public interface IClock 10 | { 11 | DateTime Time(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 4 | { 5 | public interface IUnitOfWork 6 | { 7 | void RegisterAmended(IAggregateDataModel entity, IUnitOfWorkRepository unitofWorkRepository); 8 | void RegisterNew(IAggregateDataModel entity, IUnitOfWorkRepository unitofWorkRepository); 9 | void Commit(); 10 | void Clear(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/IUnitOfWorkRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 4 | { 5 | public interface IUnitOfWorkRepository 6 | { 7 | void PersistCreationOf(IAggregateDataModel entity); 8 | void PersistUpdateOf(IAggregateDataModel entity); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.MicroORM.Application.Infrastructure 8 | { 9 | public class SystemClock : IClock 10 | { 11 | public DateTime Time() 12 | { 13 | return DateTime.Now; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/Auction/AuctionSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Model.Auction 4 | { 5 | public class AuctionSnapshot 6 | { 7 | public Guid Id { get; set; } 8 | public decimal StartingPrice { get; set; } 9 | public DateTime EndsAt { get; set; } 10 | public WinningBidSnapshot WinningBid { get; set; } 11 | public int Version { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/Auction/IAuctionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DDDPPP.Chap21.MicroORM.Application.Application; 3 | 4 | namespace DDDPPP.Chap21.MicroORM.Application.Model.Auction 5 | { 6 | public interface IAuctionRepository 7 | { 8 | void Add(Auction auction); 9 | void Save(Auction auction); 10 | Auction FindBy(Guid Id); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/Auction/MoneyCannotBeANegativeValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Model.Auction 4 | { 5 | public class MoneyCannotBeANegativeValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/Auction/MoneySnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Model.Auction 4 | { 5 | public class MoneySnapshot 6 | { 7 | public decimal Value { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/Auction/MoreThanTwoDecimalPlacesInMoneyValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Model.Auction 4 | { 5 | public class MoreThanTwoDecimalPlacesInMoneyValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/Auction/WinningBidSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.MicroORM.Application.Model.Auction 4 | { 5 | public class WinningBidSnapshot 6 | { 7 | public Guid AuctionId { get; set; } 8 | public Guid BiddersId { get; set; } 9 | public DateTime TimeOfBid { get; set; } 10 | public decimal BiddersMaximumBid { get; set; } 11 | public decimal CurrentPrice { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/Model/BidHistory/IBidHistoryRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.MicroORM.Application.Model.BidHistory 8 | { 9 | public interface IBidHistoryRepository 10 | { 11 | int NoOfBidsFor(Guid autionId); 12 | void Add(HistoricalBid bid); 13 | BidHistory FindBy(Guid auctionId); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Application/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Presentation/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.MicroORM/DDDPPP.Chap21.MicroORM.Presentation/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/21 - Repositories/DDDPPP.Chap21.NHibernateExample/.nuget/NuGet.exe -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Application/BusinessUseCases/NewAuctionRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Application.BusinessUseCases 4 | { 5 | public class NewAuctionRequest 6 | { 7 | public decimal StartingPrice { get; set; } 8 | public DateTime EndsAt { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Application/Queries/AuctionStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Application.Queries 4 | { 5 | public class AuctionStatus 6 | { 7 | public Guid Id { get; set; } 8 | public decimal CurrentPrice { get; set; } 9 | public DateTime AuctionEnds { get; set; } 10 | public Guid WinningBidderId { get; set; } 11 | public int NumberOfBids { get; set; } 12 | public TimeSpan TimeRemaining {get; set;} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Application/Queries/BidInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Application.Queries 4 | { 5 | public class BidInformation 6 | { 7 | public Guid Bidder { get; set; } 8 | public decimal AmountBid { get; set; } 9 | public string currency { get; set; } 10 | public DateTime TimeOfBid { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | namespace DDDPPP.Chap21.NHibernateExample.Application.Infrastructure 2 | { 3 | public abstract class Entity 4 | { 5 | public TId Id { get; protected set; } 6 | public int Version { get; private set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Infrastructure 4 | { 5 | public interface IClock 6 | { 7 | DateTime Time(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Infrastructure 4 | { 5 | public class SystemClock : IClock 6 | { 7 | public DateTime Time() 8 | { 9 | return DateTime.Now; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Model/Auction/IAuctionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Model.Auction 4 | { 5 | public interface IAuctionRepository 6 | { 7 | void Add(Auction auction); 8 | Auction FindBy(Guid Id); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Model/Auction/MoneyCannotBeANegativeValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Model.Auction 4 | { 5 | public class MoneyCannotBeANegativeValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Model/Auction/MoreThanTwoDecimalPlacesInMoneyValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Model.Auction 4 | { 5 | public class MoreThanTwoDecimalPlacesInMoneyValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Model/Auction/OutBid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Model.Auction 4 | { 5 | public class OutBid 6 | { 7 | public OutBid(Guid auctionId, Guid bidderId) 8 | { 9 | if (auctionId == Guid.Empty) 10 | throw new ArgumentNullException("Auction Id cannot be null"); 11 | 12 | if (bidderId == Guid.Empty) 13 | throw new ArgumentNullException("Bidder Id cannot be null"); 14 | 15 | AuctionId = auctionId; 16 | Bidder = bidderId; 17 | } 18 | 19 | public Guid AuctionId { get; private set; } 20 | public Guid Bidder { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/Model/BidHistory/IBidHistoryRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.NHibernateExample.Application.Model.BidHistory 4 | { 5 | public interface IBidHistoryRepository 6 | { 7 | int NoOfBidsFor(Guid autionId); 8 | void Add(Bid bid); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Application/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.NHibernateExample/DDDPPP.Chap21.NHibernateExample.Presentation/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/21 - Repositories/DDDPPP.Chap21.RavenDBExample/.nuget/NuGet.exe -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application.Tests/Domain/AutomaticBidderScenarios.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NUnit.Framework; 7 | 8 | namespace DDDPPP.Chap21.RavenDBExample.Application.Tests.Domain 9 | { 10 | [TestFixture] 11 | public class AutomaticBidderScenarios 12 | { 13 | [Test] 14 | public void ScenarioA() 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Application/BusinessUseCases/NewAuctionRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Application.BusinessUseCases 4 | { 5 | public class NewAuctionRequest 6 | { 7 | public decimal StartingPrice { get; set; } 8 | public DateTime EndsAt { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Application/Queries/AuctionStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Application.Queries 4 | { 5 | public class AuctionStatus 6 | { 7 | public Guid Id { get; set; } 8 | public decimal CurrentPrice { get; set; } 9 | public DateTime AuctionEnds { get; set; } 10 | public Guid WinningBidderId { get; set; } 11 | public int NumberOfBids { get; set; } 12 | public TimeSpan TimeRemaining { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Application/Queries/BidInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.RavenDBExample.Application.Application.Queries 8 | { 9 | public class BidInformation 10 | { 11 | public Guid Bidder { get; set; } 12 | public decimal AmountBid { get; set; } 13 | public string currency { get; set; } 14 | public DateTime TimeOfBid { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Infrastructure 4 | { 5 | public abstract class Entity 6 | { 7 | public TId Id { get; protected set; } 8 | public int Version { get; private set; } 9 | } 10 | } -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.RavenDBExample.Application.Infrastructure 8 | { 9 | public interface IClock 10 | { 11 | DateTime Time(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DDDPPP.Chap21.RavenDBExample.Application.Infrastructure 8 | { 9 | public class SystemClock : IClock 10 | { 11 | public DateTime Time() 12 | { 13 | return DateTime.Now; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Model/Auction/IAuctionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using DDDPPP.Chap21.RavenDBExample.Application.Application.Queries; 7 | 8 | namespace DDDPPP.Chap21.RavenDBExample.Application.Model.Auction 9 | { 10 | public interface IAuctionRepository 11 | { 12 | void Add(Auction auction); 13 | Auction FindBy(Guid Id); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Model/Auction/MoneyCannotBeANegativeValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Model.Auction 4 | { 5 | public class MoneyCannotBeANegativeValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Model/Auction/MoreThanTwoDecimalPlacesInMoneyValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Model.Auction 4 | { 5 | public class MoreThanTwoDecimalPlacesInMoneyValueException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Model/Auction/OutBid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Model.Auction 4 | { 5 | public class OutBid 6 | { 7 | public OutBid(Guid auctionId, Guid bidderId) 8 | { 9 | if (auctionId == Guid.Empty) 10 | throw new ArgumentNullException("Auction Id cannot be null"); 11 | 12 | if (bidderId == Guid.Empty) 13 | throw new ArgumentNullException("Bidder Id cannot be null"); 14 | 15 | AuctionId = auctionId; 16 | Bidder = bidderId; 17 | } 18 | 19 | public Guid AuctionId { get; private set; } 20 | public Guid Bidder { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/Model/BidHistory/IBidHistoryRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DDDPPP.Chap21.RavenDBExample.Application.Model.BidHistory 4 | { 5 | public interface IBidHistoryRepository 6 | { 7 | int NoOfBidsFor(Guid autionId); 8 | void Add(Bid bid); 9 | BidHistory FindBy(Guid auctionId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Application/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Presentation/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /21 - Repositories/DDDPPP.Chap21.RavenDBExample/DDDPPP.Chap21.RavenDBExample.Presentation/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /21 - Repositories/Database_script_for_examples.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/21 - Repositories/Database_script_for_examples.sql -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDD.Chap23.EventSourcing.EventStoreDemo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/22 - Event Sourcing/PPPDDDChap22/.nuget/NuGet.exe -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 4 | { 5 | public abstract class Entity 6 | { 7 | public Guid Id { get; protected set; } 8 | } 9 | } -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Infrastructure/EventSourcedAggregate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public abstract class EventSourcedAggregate : Entity 10 | { 11 | public List Changes { get; private set; } 12 | public int Version { get; protected set; } 13 | 14 | public EventSourcedAggregate() 15 | { 16 | Changes = new List(); 17 | } 18 | 19 | public abstract void Apply(DomainEvent changes); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public interface IClock 10 | { 11 | DateTime Time(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public class SystemClock : IClock 10 | { 11 | public DateTime Time() 12 | { 13 | return DateTime.Now; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/AccountCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using PPPDDDChap23.EventSourcing.Application.Infrastructure; 7 | 8 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 9 | { 10 | public class AccountCreated : DomainEvent 11 | { 12 | public AccountCreated(Guid aggregateId, Money credit) 13 | : base(aggregateId) 14 | { 15 | Credit = credit; 16 | } 17 | 18 | public Money Credit { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/CreditAdded.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using PPPDDDChap23.EventSourcing.Application.Infrastructure; 7 | 8 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 9 | { 10 | public class CreditAdded : DomainEvent 11 | { 12 | public CreditAdded(Guid aggregateId, Money credit) 13 | : base(aggregateId) 14 | { 15 | Credit = credit; 16 | } 17 | 18 | public Money Credit { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/IPayAsYouGoAccountRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public interface IPayAsYouGoAccountRepository 10 | { 11 | PayAsYouGoAccount FindBy(Guid id); 12 | 13 | void Add(PayAsYouGoAccount payAsYouGoAccount); 14 | 15 | void Save(PayAsYouGoAccount payAsYouGoAccount); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PayAsYouGoAccountSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PayAsYouGoAccountSnapshot 10 | { 11 | public int Version {get; set;} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PhoneCall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PhoneCall 10 | { 11 | public PhoneCall(PhoneNumber numberDialled, DateTime callStart, Minutes callLength) 12 | { 13 | NumberDialled = numberDialled; 14 | Minutes = callLength; 15 | StartTime = callStart; 16 | } 17 | 18 | public DateTime StartTime {get; private set;} 19 | public Minutes Minutes {get; private set;} 20 | public PhoneNumber NumberDialled { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PhoneCallCosting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PhoneCallCosting 10 | { 11 | private Money PricePerMinute { get; set; } 12 | 13 | public PhoneCallCosting() 14 | { 15 | PricePerMinute = new Money(0.30m); 16 | } 17 | 18 | public Money DetermineCostOfCall(Minutes minutes) 19 | { 20 | return minutes.CostAt(PricePerMinute); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PhoneNumber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PhoneNumber 10 | { 11 | public PhoneNumber(string phoneNumber) 12 | { 13 | Number = phoneNumber; 14 | } 15 | 16 | public string Number { get; set; } 17 | 18 | public bool IsUKLandlineOrMobile() 19 | { 20 | return Number.StartsWith("+44"); 21 | } 22 | 23 | public bool IsInternational() 24 | { 25 | return !IsUKLandlineOrMobile(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Application/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.ApplicationTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Presentation/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap22/PPPDDDChap23.EventSourcing.Presentation/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/22 - Event Sourcing/PPPDDDChap23.EventSourcing/.nuget/NuGet.exe -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Infrastructure/DomainEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public abstract class DomainEvent 10 | { 11 | public DomainEvent(Guid aggregateId) 12 | { 13 | Id = aggregateId; 14 | } 15 | 16 | public Guid Id { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Infrastructure/Entity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 4 | { 5 | public abstract class Entity 6 | { 7 | public Guid Id { get; protected set; } 8 | } 9 | } -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Infrastructure/EventSourcedAggregate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public abstract class EventSourcedAggregate : Entity 10 | { 11 | public List Changes { get; private set; } 12 | public int Version { get; protected set; } 13 | 14 | public EventSourcedAggregate() 15 | { 16 | Changes = new List(); 17 | } 18 | 19 | public abstract void Apply(DomainEvent changes); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Infrastructure/IClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public interface IClock 10 | { 11 | DateTime Time(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Infrastructure/SystemClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Infrastructure 8 | { 9 | public class SystemClock : IClock 10 | { 11 | public DateTime Time() 12 | { 13 | return DateTime.Now; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/AccountCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using PPPDDDChap23.EventSourcing.Application.Infrastructure; 7 | 8 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 9 | { 10 | public class AccountCreated : DomainEvent 11 | { 12 | public AccountCreated(Guid aggregateId, Money credit) 13 | : base(aggregateId) 14 | { 15 | Credit = credit; 16 | } 17 | 18 | public Money Credit { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/CreditAdded.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using PPPDDDChap23.EventSourcing.Application.Infrastructure; 7 | 8 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 9 | { 10 | public class CreditAdded : DomainEvent 11 | { 12 | public CreditAdded(Guid aggregateId, Money credit) 13 | : base(aggregateId) 14 | { 15 | Credit = credit; 16 | } 17 | 18 | public Money Credit { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/IPayAsYouGoAccountRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public interface IPayAsYouGoAccountRepository 10 | { 11 | PayAsYouGoAccount FindBy(Guid id); 12 | 13 | void Add(PayAsYouGoAccount payAsYouGoAccount); 14 | 15 | void Save(PayAsYouGoAccount payAsYouGoAccount); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PayAsYouGoAccountSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PayAsYouGoAccountSnapshot 10 | { 11 | public int Version { get; set; } 12 | 13 | public decimal Credit { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PhoneCall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PhoneCall 10 | { 11 | public PhoneCall(PhoneNumber numberDialled, DateTime callStart, Minutes callLength) 12 | { 13 | NumberDialled = numberDialled; 14 | Minutes = callLength; 15 | StartTime = callStart; 16 | } 17 | 18 | public DateTime StartTime {get; private set;} 19 | public Minutes Minutes {get; private set;} 20 | public PhoneNumber NumberDialled { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PhoneCallCosting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PhoneCallCosting 10 | { 11 | private Money PricePerMinute { get; set; } 12 | 13 | public PhoneCallCosting() 14 | { 15 | PricePerMinute = new Money(0.30m); 16 | } 17 | 18 | public virtual Money DetermineCostOfCall(Minutes minutes) 19 | { 20 | return minutes.CostAt(PricePerMinute); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/Model/PayAsYouGo/PhoneNumber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PPPDDDChap23.EventSourcing.Application.Model.PayAsYouGo 8 | { 9 | public class PhoneNumber 10 | { 11 | public PhoneNumber(string phoneNumber) 12 | { 13 | Number = phoneNumber; 14 | } 15 | 16 | public string Number { get; set; } 17 | 18 | public bool IsUKLandlineOrMobile() 19 | { 20 | return Number.StartsWith("+44"); 21 | } 22 | 23 | public bool IsInternational() 24 | { 25 | return !IsUKLandlineOrMobile(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Application/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.ApplicationTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Presentation/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /22 - Event Sourcing/PPPDDDChap23.EventSourcing/PPPDDDChap23.EventSourcing.Presentation/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /22 - Event Sourcing/README.md: -------------------------------------------------------------------------------- 1 | PPPDDDChap23 2 | ============ 3 | 4 | Principles, Practices and Patterns of Domain-Driven Design: Chapter 23 Event Sourcing Code Samples 5 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPDDD.NonDist.UIComp 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Mvc; 4 | 5 | namespace PPPDDD.NonDist.UIComp.Controllers 6 | { 7 | public class HomeController : Controller 8 | { 9 | public ActionResult Index() 10 | { 11 | return View(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="PPPDDD.NonDist.UIComp.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPDDD.NonDist.UIComp 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | RouteConfig.RegisterRoutes(RouteTable.Routes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Views/CatalogBoundedContext/ItemInBasket.cshtml: -------------------------------------------------------------------------------- 1 | @model PPPDDD.NonDist.UIComp.SalesBoundedContext.Product 2 | 3 |
4 |

@Model.Name

5 |

6 | 7 | @Model.Description 8 |

9 |
10 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Views/PricingBoundedContext/Price.cshtml: -------------------------------------------------------------------------------- 1 | @model int 2 | 3 |
4 | $@String.Format(Model.ToString(), "##.##") 5 |
6 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Views/ShippingBoundedContext/DeliveryOptions.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 |
4 |

Delivery Options

5 | @foreach(var option in Model) 6 | { 7 |

8 | @Html.RadioButton("deliveryOptions", option.ID) 9 | @option.Name - $@String.Format(option.Price.ToString(), "##.##") 10 | (@option.Duration.Item1 - @option.Duration.Item2 days) 11 |

12 | 13 | } 14 |
15 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPDDD.NonDist.UIComp/PPPDDD.NonDist.UIComp/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPSSS.Dist.UIComp/PPPSSS.Dist.UIComp/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPSSS.Dist.UIComp 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPSSS.Dist.UIComp/PPPSSS.Dist.UIComp/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Mvc; 4 | 5 | namespace PPPSSS.Dist.UIComp.Controllers 6 | { 7 | public class HomeController : Controller 8 | { 9 | public ViewResult Index() 10 | { 11 | return View(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPSSS.Dist.UIComp/PPPSSS.Dist.UIComp/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="PPPSSS.Dist.UIComp.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPSSS.Dist.UIComp/PPPSSS.Dist.UIComp/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPSSS.Dist.UIComp 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | RouteConfig.RegisterRoutes(RouteTable.Routes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPSSS.Dist.UIComp/PPPSSS.Dist.UIComp/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/PPPSSS.Dist.UIComp/PPPSSS.Dist.UIComp/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /23 - Architecting Application User Interfaces/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /24 - CQRS An Architecture of A Bounded Context/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/.nuget/NuGet.exe -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Application/Commands/ApplyCouponToBasketCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure; 3 | 4 | namespace Agathas.Storefront.Shopping.Commands 5 | { 6 | public class ApplyCouponToBasketCommand : IBusinessRequest 7 | { 8 | public ApplyCouponToBasketCommand(Guid basket_id, string voucher_id) 9 | { 10 | this.basket_id = basket_id; 11 | // check to see if voucher id is null 12 | 13 | this.voucher_id = voucher_id; 14 | } 15 | 16 | public string voucher_id { get; set; } 17 | public Guid basket_id { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Application/Commands/CreateABasketCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure; 3 | 4 | namespace Agathas.Storefront.Shopping.Commands 5 | { 6 | public class CreateABasketCommand : IBusinessRequest 7 | { 8 | public Guid basket_id { get; set; } 9 | 10 | public CreateABasketCommand(Guid basket_id) 11 | { 12 | this.basket_id = basket_id; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Application/Commands/RemoveProductFromBasketCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure; 3 | 4 | namespace Agathas.Storefront.Shopping.Commands 5 | { 6 | public class RemoveProductFromBasketCommand : IBusinessRequest 7 | { 8 | public RemoveProductFromBasketCommand(Guid get_basket_id, int product_id) 9 | { 10 | this.get_basket_id = get_basket_id; 11 | this.product_id = product_id; 12 | } 13 | 14 | public Guid get_basket_id { get; set; } 15 | public int product_id { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Application/Commands/UpdateBasketDeliveryCountry.cs: -------------------------------------------------------------------------------- 1 | using Agathas.Storefront.Infrastructure; 2 | 3 | namespace Agathas.Storefront.Shopping.Commands 4 | { 5 | public class UpdateBasketDeliveryCountry : IBusinessRequest 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Application/Contract/_readme.txt: -------------------------------------------------------------------------------- 1 | put here any events other Bounded Contexts are interested in. -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Application/ReadModel/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Agathas.Storefront.Shopping.ReadModel 7 | { 8 | class Product 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/DomainEventHandlerRegistery.cs: -------------------------------------------------------------------------------- 1 | using Agathas.Storefront.Infrastructure; 2 | using StructureMap; 3 | 4 | namespace Agathas.Storefront.Application 5 | { 6 | public class DomainEventHandlerRegistery : IDomainEventHandlerRegistery 7 | { 8 | public void handle(TEvent domain_event) where TEvent : IDomainEvent 9 | { 10 | var handler = ObjectFactory.TryGetInstance>(); 11 | 12 | handler.action(domain_event); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Infrastructure/BasketRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure.Repositories; 3 | using Agathas.Storefront.Shopping.Baskets; 4 | using Agathas.Storefront.Shopping.Model.Baskets; 5 | 6 | namespace Agathas.Storefront.Shopping.Infrastructure 7 | { 8 | public class BasketRepository : NhRepository, IBasketRepository 9 | { 10 | public BasketRepository(ISessionCoordinator session) 11 | : base(session) 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Infrastructure/PromotionsRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure.Repositories; 3 | using Agathas.Storefront.Shopping.Model.Promotions; 4 | 5 | namespace Agathas.Storefront.Shopping.Infrastructure 6 | { 7 | public class PromotionsRepository : NhRepository, IPromotionsRepository 8 | { 9 | public PromotionsRepository(ISessionCoordinator session) 10 | : base(session) 11 | { 12 | } 13 | 14 | public Promotion find_by(string voucher_code) 15 | { 16 | return base.query_for_single(x => x.voucher_code == voucher_code); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Baskets/BasketItemFactory.cs: -------------------------------------------------------------------------------- 1 | using Agathas.Storefront.Shopping.Baskets; 2 | 3 | namespace Agathas.Storefront.Shopping.Model.Baskets 4 | { 5 | public static class BasketItemFactory 6 | { 7 | public static BasketItem create_item_for(ProductSnapshot product_snapshot) 8 | { 9 | return new BasketItem(product_snapshot, new NonNegativeQuantity(1)); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Baskets/Events/BasketCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Common; 3 | using Agathas.Storefront.Infrastructure; 4 | 5 | namespace Agathas.Storefront.Shopping.Baskets.Events 6 | { 7 | public class BasketCreated : IDomainEvent 8 | { 9 | public BasketCreated(Guid id, Money amountToPay) 10 | { 11 | Id = id; 12 | AmountToPay = amountToPay; 13 | } 14 | 15 | public Guid Id { get; set; } 16 | public Money AmountToPay { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Baskets/Events/BasketModified.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure; 3 | 4 | namespace Agathas.Storefront.Sales.Model.Baskets.Events 5 | { 6 | public class BasketModified : IDomainEvent 7 | { 8 | public BasketModified(Guid basket_id) 9 | { 10 | this.basket_id = basket_id; 11 | } 12 | 13 | public Guid basket_id { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Baskets/Events/CouponNotApplicableForBasketItems.cs: -------------------------------------------------------------------------------- 1 | using Agathas.Storefront.Infrastructure; 2 | 3 | namespace Agathas.Storefront.Shopping.Model.Baskets.Events 4 | { 5 | public class CouponNotApplicableForBasketItems : IDomainEvent 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Baskets/IBasketPricingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Agathas.Storefront.Shopping.Model.Promotions; 4 | 5 | namespace Agathas.Storefront.Shopping.Model.Baskets 6 | { 7 | public interface IBasketPricingService 8 | { 9 | BasketPricingBreakdown calculate_total_price_for(IEnumerable items, IEnumerable coupons ); 10 | } 11 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Baskets/IBasketRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure; 3 | 4 | namespace Agathas.Storefront.Shopping.Model.Baskets 5 | { 6 | public interface IBasketRepository : IRepository 7 | { 8 | //Basket find_by(int basketId); 9 | //void add(Basket basket); 10 | } 11 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Promotions/Coupon.cs: -------------------------------------------------------------------------------- 1 | namespace Agathas.Storefront.Shopping.Model.Promotions 2 | { 3 | public class Coupon 4 | { 5 | public string code { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Promotions/CouponIssues.cs: -------------------------------------------------------------------------------- 1 | namespace Agathas.Storefront.Shopping.Model.Promotions 2 | { 3 | public enum CouponIssues 4 | { 5 | NotApplied = 0, 6 | NoIssue = 1 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Promotions/ICouponPolicy.cs: -------------------------------------------------------------------------------- 1 | namespace Agathas.Storefront.Shopping.Model.Promotions 2 | { 3 | public interface ICouponPolicy 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Promotions/IPromotionsRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Agathas.Storefront.Infrastructure; 3 | 4 | namespace Agathas.Storefront.Shopping.Model.Promotions 5 | { 6 | public interface IPromotionsRepository : IRepository 7 | { 8 | Promotion find_by(string voucher_code); 9 | } 10 | } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Application/Model/Promotions/PromotionNotApplicableException.cs: -------------------------------------------------------------------------------- 1 | using Agathas.Storefront.Infrastructure; 2 | 3 | namespace Agathas.Storefront.Shopping.Model.Promotions 4 | { 5 | public class PromotionNotApplicableException : DomainException 6 | { 7 | public PromotionNotApplicableException(string message_for_customer) : base(message_for_customer) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/jquery.ui.all.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.8.20 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Licensed under the MIT license. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Theming 9 | */ 10 | @import "jquery.ui.base.css"; 11 | @import "jquery.ui.theme.css"; 12 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/jquery.ui.progressbar.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Progressbar 1.8.20 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Licensed under the MIT license. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Progressbar#theming 9 | */ 10 | .ui-progressbar { height:2em; text-align: left; overflow: hidden; } 11 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/jquery.ui.selectable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Selectable 1.8.20 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Licensed under the MIT license. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Selectable#theming 9 | */ 10 | .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } 11 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elbandit/PPPDDD/4d9d864fa6d9dfc0bad323ae21e949be1808b460/25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/jquery.ui.autocomplete.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.20 - 2012-04-30 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.autocomplete.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT */ 5 | .ui-autocomplete{position:absolute;cursor:default}* html .ui-autocomplete{width:1px}.ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left}.ui-menu .ui-menu{margin-top:-3px}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1}.ui-menu .ui-menu-item a.ui-state-hover,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px} -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/jquery.ui.progressbar.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.20 - 2012-04-30 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.progressbar.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT */ 5 | .ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%} -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Content/themes/base/minified/jquery.ui.selectable.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.20 - 2012-04-30 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.selectable.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT */ 5 | .ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black} -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace DDDPPP.Chap20.CommandHandler.Presentation.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | ViewBag.Message = "Welcome to ASP.NET MVC!"; 14 | 15 | return View(); 16 | } 17 | 18 | public ActionResult About() 19 | { 20 | return View(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="DDDPPP.Chap20.CommandHandler.Presentation.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Views/Account/ChangePasswordSuccess.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | 4 | Change Password 5 | 6 | 7 | 8 |

Change Password

9 |

10 | Your password has been changed successfully. 11 |

12 |
13 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Views/Home/About.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | 4 | About Us 5 | 6 | 7 | 8 |

About

9 |

10 | Put content here. 11 |

12 |
13 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Views/Home/Index.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | 4 | Home Page 5 | 6 | 7 | 8 |

<%: ViewBag.Message %>

9 |

10 | To learn more about ASP.NET MVC visit http://asp.net/mvc. 11 |

12 |
13 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Views/Shared/Error.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | 4 | Error 5 | 6 | 7 | 8 |

9 | Sorry, an error occurred while processing your request. 10 |

11 |
12 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/DDDPPP.Chap20.CommandHandler.Presentation/Views/Shared/LogOnUserControl.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 2 | <% 3 | if (Request.IsAuthenticated) { 4 | %> 5 | Welcome <%: Page.User.Identity.Name %>! 6 | [ <%: Html.ActionLink("Log Off", "LogOff", "Account") %> ] 7 | <% 8 | } 9 | else { 10 | %> 11 | [ <%: Html.ActionLink("Log On", "LogOn", "Account") %> ] 12 | <% 13 | } 14 | %> 15 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/PPPDDD.ApplicationServices.Gambling/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="PPPDDD.ApplicationServices.Gambling.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/PPPDDD.ApplicationServices.Gambling/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPDDD.ApplicationServices.Gambling 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | RouteConfig.RegisterRoutes(RouteTable.Routes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /25 - Commands Application Service Patterns for processing Business Use Cases/PPPDDD.ApplicationServices.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/PPPDDD.Reporting/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPDDD.Reporting 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/PPPDDD.Reporting/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="PPPDDD.Reporting.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/PPPDDD.Reporting/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace PPPDDD.Reporting 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | RouteConfig.RegisterRoutes(RouteTable.Routes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/PPPDDD.Reporting/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/PPPDDD.Reporting/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/SportsStoreDatabase/LoyaltyAccounts.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[LoyaltyAccounts] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY, 4 | [UserId] INT NOT NULL, 5 | [IsActive] BIT NOT NULL, 6 | [Create] DATE NOT NULL, 7 | FOREIGN KEY (UserId) REFERENCES Users(Id) 8 | ) 9 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/SportsStoreDatabase/LoyaltySettings.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[LoyaltySettings] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY, 4 | [Month] DATE NOT NULL, 5 | [PointsPerDollar] INT NOT NULL 6 | ) 7 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/SportsStoreDatabase/Orders.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Orders] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY, 4 | [Date] Date NOT NULL, 5 | [UserId] INT NOT NULL, 6 | [NetProfit] DECIMAL NOT NULL, 7 | FOREIGN KEY (UserId) REFERENCES Users(Id) 8 | ) 9 | -------------------------------------------------------------------------------- /26 - Queries Domain Reporting/SportsStoreDatabase/Users.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Users] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY 4 | ) 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | -------------------------------------------------------------------------------- /eBidder Case Study/README.md: -------------------------------------------------------------------------------- 1 | PPPDDD 2 | ====== 3 | 4 | Sample code for the book Principles, Practices and Patterns of Domain-Driven Design. From the book http://www.amazon.com/Professional-Domain-Driven-Design-Patterns/dp/1118714709/ 5 | --------------------------------------------------------------------------------