├── .vs
└── Value
│ ├── FileContentIndex
│ ├── read.lock
│ └── 028162b3-4b40-4b33-8be6-a021bd5c9cc8.vsidx
│ ├── v15
│ └── Server
│ │ └── sqlite3
│ │ ├── db.lock
│ │ ├── storage.ide
│ │ ├── storage.ide-shm
│ │ └── storage.ide-wal
│ └── DesignTimeBuild
│ └── .dtbcache.v2
├── Value.jpg
├── Value.snk
├── Value-icon.jpg
├── Value-small.jpg
├── Value.Net40
├── Value.snk
└── Value.Net40.csproj
├── Value.Net45
├── Value.snk
├── Value.Net45.csproj.DotSettings
└── Value.Net45.csproj
├── Value.Standard
├── Value.snk
└── Value.Standard.csproj
├── Value.Tests
├── packages.config
├── Value.Tests.csproj.DotSettings
├── Domain.Helpers.Tests.csproj.DotSettings
├── Samples
│ ├── Suit.cs
│ ├── Currency.cs
│ ├── ItemPriceWithBadImplementationForEqualityAndUnicity.cs
│ ├── ThreeCards.cs
│ ├── ItemPrice.cs
│ ├── ThreeCardsBadlyImplementedAsValueType.cs
│ ├── Amount.cs
│ └── Card.cs
├── AmountShould.cs
├── Value.Tests.csproj
├── ValueTypeShould.cs
├── ListByValueShould.cs
├── DictionaryByValueShould.cs
└── SetByValueShould.cs
├── ReleaseNoteContentToBeInsertedWithinNuspecFile.txt
├── BackLog.md
├── appveyor.yml
├── Value
├── Value.Shared.projitems
├── Value.shproj
├── ValueType.cs
├── EquatableByValueWithoutOrder.cs
├── ListByValue.cs
├── EquatableByValue.cs
├── DictionaryByValue.cs
└── SetByValue.cs
├── Version.cs
├── Value.nuspec
├── ImplementationDetails.md
├── .build
├── Build.tasks
└── Build.proj
├── .gitignore
├── Value.sln
├── Readme.md
└── LICENSE
/.vs/Value/FileContentIndex/read.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vs/Value/v15/Server/sqlite3/db.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Value.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value.jpg
--------------------------------------------------------------------------------
/Value.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value.snk
--------------------------------------------------------------------------------
/Value-icon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value-icon.jpg
--------------------------------------------------------------------------------
/Value-small.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value-small.jpg
--------------------------------------------------------------------------------
/Value.Net40/Value.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value.Net40/Value.snk
--------------------------------------------------------------------------------
/Value.Net45/Value.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value.Net45/Value.snk
--------------------------------------------------------------------------------
/Value.Standard/Value.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/Value.Standard/Value.snk
--------------------------------------------------------------------------------
/.vs/Value/DesignTimeBuild/.dtbcache.v2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/.vs/Value/DesignTimeBuild/.dtbcache.v2
--------------------------------------------------------------------------------
/.vs/Value/v15/Server/sqlite3/storage.ide:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/.vs/Value/v15/Server/sqlite3/storage.ide
--------------------------------------------------------------------------------
/.vs/Value/v15/Server/sqlite3/storage.ide-shm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/.vs/Value/v15/Server/sqlite3/storage.ide-shm
--------------------------------------------------------------------------------
/.vs/Value/v15/Server/sqlite3/storage.ide-wal:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/.vs/Value/v15/Server/sqlite3/storage.ide-wal
--------------------------------------------------------------------------------
/.vs/Value/FileContentIndex/028162b3-4b40-4b33-8be6-a021bd5c9cc8.vsidx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tpierrain/Value/HEAD/.vs/Value/FileContentIndex/028162b3-4b40-4b33-8be6-a021bd5c9cc8.vsidx
--------------------------------------------------------------------------------
/Value.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ReleaseNoteContentToBeInsertedWithinNuspecFile.txt:
--------------------------------------------------------------------------------
1 | New feature(s):
2 | * Support for .Net Standard (ex .Net Core), .NET 4.0 and .NET 4.5
3 | * Add support for Dictionary with the new DictionaryByValue<T> decorator.
4 |
5 | --------------
6 |
7 | Change(s):
8 | *
9 |
10 | --------------
11 | Bug Fixe(s):
12 | *
13 |
--------------------------------------------------------------------------------
/BackLog.md:
--------------------------------------------------------------------------------
1 | # Value's Backlog
2 |
3 | 1. Extract Concrete type from base class EquatableByValue that may be agreggated and reused by it and other types (i.e. favor composition over inheritance)
4 | 1. Implement decorators: DictionaryByValue, StackByValue, QueueByValue
5 | 1. Find better names for ....ByValue
6 | 1. Profile perf and improve implementations if necessary
7 |
--------------------------------------------------------------------------------
/Value.Net45/Value.Net45.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | Off
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.1.1.{build}
2 | image: Visual Studio 2017
3 | branches:
4 | only:
5 | - master
6 | configuration: Release
7 | platform: Any CPU
8 | build_script:
9 | - cmd: build.cmd Release
10 | build:
11 | verbosity: minimal
12 | test: auto
13 |
14 | artifacts:
15 | - path: 'Artifacts\Packages\*.nupkg'
16 |
17 | assembly_info:
18 | patch: true
19 | file: version.cs
20 | assembly_version: '{version}'
21 | assembly_file_version: '{version}'
22 | assembly_informational_version: '{version}'
23 |
--------------------------------------------------------------------------------
/Value.Tests/Value.Tests.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | False
--------------------------------------------------------------------------------
/Value.Standard/Value.Standard.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard1.3
5 | Value
6 | false
7 | Value
8 | true
9 | Value.snk
10 | false
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Value.Tests/Domain.Helpers.Tests.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
--------------------------------------------------------------------------------
/Value/Value.Shared.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | 44709b35-26e8-4588-a87a-1727cdb11255
7 |
8 |
9 | Value.Shared
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Value/Value.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 44709b35-26e8-4588-a87a-1727cdb11255
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Value.Tests/Samples/Suit.cs:
--------------------------------------------------------------------------------
1 | // // --------------------------------------------------------------------------------------------------------------------
2 | // //
3 | // // Copyright 2016
4 | // // Thomas PIERRAIN (@tpierrain)
5 | // // Licensed under the Apache License, Version 2.0 (the "License");
6 | // // you may not use this file except in compliance with the License.
7 | // // You may obtain a copy of the License at
8 | // // http://www.apache.org/licenses/LICENSE-2.0
9 | // // Unless required by applicable law or agreed to in writing, software
10 | // // distributed under the License is distributed on an "AS IS" BASIS,
11 | // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // // See the License for the specific language governing permissions and
13 | // // limitations under the License.b
14 | // //
15 | // // --------------------------------------------------------------------------------------------------------------------
16 | namespace Value.Tests.Samples
17 | {
18 | ///
19 | /// Possible Suits for poker cards.
20 | ///
21 | public enum Suit
22 | {
23 | C, // Club
24 |
25 | D, // Diamond
26 |
27 | H, // Heart
28 |
29 | S // Spade
30 | }
31 | }
--------------------------------------------------------------------------------
/Value.Tests/Samples/Currency.cs:
--------------------------------------------------------------------------------
1 | // // --------------------------------------------------------------------------------------------------------------------
2 | // //
3 | // // Copyright 2016
4 | // // Thomas PIERRAIN (@tpierrain)
5 | // // Licensed under the Apache License, Version 2.0 (the "License");
6 | // // you may not use this file except in compliance with the License.
7 | // // You may obtain a copy of the License at
8 | // // http://www.apache.org/licenses/LICENSE-2.0
9 | // // Unless required by applicable law or agreed to in writing, software
10 | // // distributed under the License is distributed on an "AS IS" BASIS,
11 | // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // // See the License for the specific language governing permissions and
13 | // // limitations under the License.b
14 | // //
15 | // // --------------------------------------------------------------------------------------------------------------------
16 | namespace Value.Tests.Samples
17 | {
18 | ///
19 | /// Any form of money issued by a government or central bank and used as legal tender and a basis for trade.
20 | ///
21 | public enum Currency
22 | {
23 | Euro,
24 |
25 | Dollar,
26 |
27 | Pound,
28 |
29 | Yuan,
30 |
31 | Yen
32 | }
33 | }
--------------------------------------------------------------------------------
/Version.cs:
--------------------------------------------------------------------------------
1 | // Licensed under the Apache License, Version 2.0 (the "License");
2 | // you may not use this file except in compliance with the License.
3 | // You may obtain a copy of the License at
4 | // http://www.apache.org/licenses/LICENSE-2.0
5 | // Unless required by applicable law or agreed to in writing, software
6 | // distributed under the License is distributed on an "AS IS" BASIS,
7 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 | // See the License for the specific language governing permissions and
9 | // limitations under the License.
10 | //
11 | // This file contains common assembly attributes
12 | // --------------------------------------------------------------------------------------------------------------------
13 |
14 | using System.Reflection;
15 |
16 | [assembly: AssemblyProduct("Value")]
17 | [assembly: AssemblyCopyright("Copyright © Thomas PIERRAIN 2016-2018")]
18 | [assembly: AssemblyCompany("Thomas PIERRAIN")]
19 |
20 | // Version information for an assembly consists of the following four values:
21 | //
22 | // Major Version
23 | // Minor Version
24 | // Build Number
25 | // Revision
26 | //
27 | // You can specify all the values or you can default the Build and Revision Numbers
28 | // by using the '*' as shown below:
29 | // [assembly: AssemblyVersion("1.0.*")]
30 | [assembly: AssemblyVersion("1.0.0.0")]
31 | [assembly: AssemblyFileVersion("1.0.0.0")]
32 |
--------------------------------------------------------------------------------
/Value/ValueType.cs:
--------------------------------------------------------------------------------
1 | // // --------------------------------------------------------------------------------------------------------------------
2 | // //
3 | // // Copyright 2016
4 | // // Thomas PIERRAIN (@tpierrain)
5 | // // Licensed under the Apache License, Version 2.0 (the "License");
6 | // // you may not use this file except in compliance with the License.
7 | // // You may obtain a copy of the License at
8 | // // http://www.apache.org/licenses/LICENSE-2.0
9 | // // Unless required by applicable law or agreed to in writing, software
10 | // // distributed under the License is distributed on an "AS IS" BASIS,
11 | // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // // See the License for the specific language governing permissions and
13 | // // limitations under the License.b
14 | // //
15 | // // --------------------------------------------------------------------------------------------------------------------
16 | namespace Value
17 | {
18 | ///
19 | /// Base class for any Value Type (i.e. the 'Value Object' oxymoron of DDD).
20 | /// All you have to do is to implement the abstract methods:
21 | ///
22 | /// Domain type to be 'turned' into a Value Type.
23 | public abstract class ValueType : EquatableByValue
24 | {
25 | }
26 | }
--------------------------------------------------------------------------------
/Value.Tests/Samples/ItemPriceWithBadImplementationForEqualityAndUnicity.cs:
--------------------------------------------------------------------------------
1 | // // --------------------------------------------------------------------------------------------------------------------
2 | // //
3 | // // Copyright 2016
4 | // // Thomas PIERRAIN (@tpierrain)
5 | // // Licensed under the Apache License, Version 2.0 (the "License");
6 | // // you may not use this file except in compliance with the License.
7 | // // You may obtain a copy of the License at
8 | // // http://www.apache.org/licenses/LICENSE-2.0
9 | // // Unless required by applicable law or agreed to in writing, software
10 | // // distributed under the License is distributed on an "AS IS" BASIS,
11 | // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // // See the License for the specific language governing permissions and
13 | // // limitations under the License.b
14 | // //
15 | // // --------------------------------------------------------------------------------------------------------------------
16 | namespace Value.Tests.Samples
17 | {
18 | ///
19 | /// Price for an item. Bad Value Type implementation because doesn't override GetAllAttributesToBeUsedForEquality()
20 | ///
21 | public class ItemPriceWithBadImplementationForEqualityAndUnicity : Amount
22 | {
23 | public ItemPriceWithBadImplementationForEqualityAndUnicity(string itemName, decimal quantity, Currency currency) : base(quantity, currency)
24 | {
25 | this.ItemName = itemName;
26 | }
27 |
28 | public string ItemName { get; private set; }
29 |
30 | public override string ToString()
31 | {
32 | return $"{this.ItemName} - price: {this.Quantity} {this.Currency}.";
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Value.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Value
5 | Value
6 | 2.0.0.00
7 | Thomas PIERRAIN
8 | Thomas PIERRAIN
9 | http://www.apache.org/licenses/LICENSE-2.0
10 | https://github.com/tpierrain/Value/
11 | false
12 | https://raw.githubusercontent.com/tpierrain/Value/master/Value-icon.jpg
13 | Value is a pico library (or code snippets shed) to help you to easily implement Value Types (also known as Value Objects in DDD) in your C# projects without making implementation errors nor polluting your domain logic with boiler-plate code.
14 | Less Entities, more Value Types with easy-to-use and lightweight helpers.
15 | New feature(s):
16 |
17 | * Support for .Net Standard (ex .Net Core)
18 |
19 | * Provide the following helpers: ValueType<T>, ListByValue<T>, SetByValue<T>
20 |
21 | --------------
22 |
23 | Change(s):
24 |
25 | *
26 |
27 | --------------
28 |
29 | Bug Fixe(s):
30 |
31 | *
32 | Copyright 2016-2017 Thomas PIERRAIN
33 | en-US
34 | DDD domain value object type tactical pattern pico library
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Value.Tests/Samples/ThreeCards.cs:
--------------------------------------------------------------------------------
1 | // // --------------------------------------------------------------------------------------------------------------------
2 | // //
3 | // // Copyright 2016
4 | // // Thomas PIERRAIN (@tpierrain)
5 | // // Licensed under the Apache License, Version 2.0 (the "License");
6 | // // you may not use this file except in compliance with the License.
7 | // // You may obtain a copy of the License at
8 | // // http://www.apache.org/licenses/LICENSE-2.0
9 | // // Unless required by applicable law or agreed to in writing, software
10 | // // distributed under the License is distributed on an "AS IS" BASIS,
11 | // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // // See the License for the specific language governing permissions and
13 | // // limitations under the License.b
14 | // //
15 | // // --------------------------------------------------------------------------------------------------------------------
16 | namespace Value.Tests.Samples
17 | {
18 | using System.Collections.Generic;
19 |
20 | ///
21 | /// Proper implementation of a ThreeeCards ValueType since the order of the cards doesn't matter during
22 | /// Equality.
23 | ///
24 | public class ThreeCards : ValueType
25 | {
26 | private readonly HashSet cards;
27 |
28 | public ThreeCards(string card1Description, string card2Description, string card3Description)
29 | {
30 | this.cards = new HashSet();
31 |
32 | this.cards.Add(Card.Parse(card1Description));
33 | this.cards.Add(Card.Parse(card2Description));
34 | this.cards.Add(Card.Parse(card3Description));
35 | }
36 |
37 | protected override IEnumerable