Skip to content

Commit 3f02024

Browse files
committed
Show more details about the workflow
1 parent 56d848d commit 3f02024

File tree

11 files changed

+25
-16
lines changed

11 files changed

+25
-16
lines changed

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/GhostsExample/GhostCollege.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace LazyLoadLibrary.GhostsExample
44
{
55
/// <summary>
6-
/// A ghost is the object that is to be loaded in a partial state.
6+
/// A ghost is an object that is to be loaded in a partial state.
77
/// It may only contain the object's identifier, but it loads its own data
88
/// the first time one of its properties is accessed.
9-
/// It is a fake object that looks exactly like an object that you want to interact with
9+
/// It is a fake object that looks exactly like an object that you want to interact with,
1010
/// but is just an empty instance that gets all properties populated as soon as they are needed.
1111
/// Beware of ripple loading when using lazy load.
1212
/// </summary>
@@ -74,7 +74,7 @@ protected override object[] FetchData()
7474
{
7575
return new object[3]
7676
{
77-
"Learn, Discover, Heal, Createand Make the World Ever Better",
77+
"Learn, Discover, Heal, Create, and Make the World Ever Better",
7878
850,
7979
new Library(),
8080
};

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/GhostsExample/GhostsExecutor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BuildingBlocks;
1+
using System;
2+
using BuildingBlocks;
23

34
namespace LazyLoadLibrary.GhostsExample
45
{
@@ -12,7 +13,10 @@ public static void Execute()
1213
var college = collegeFactory.CreateFromId(1);
1314

1415
// College library shouldn't have been constructed before calling ShowDetails method.
16+
Console.WriteLine("Give me more details about the college!");
1517
college.ShowDetails();
18+
19+
Console.WriteLine("\nGive me more details about the college!");
1620
college.ShowDetails();
1721
}
1822
}

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/LazyInitializationExample/LazyCollege.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public Library Library
1212
{
1313
if (_library == null)
1414
{
15-
// This works, but it's not thread-safe
15+
// This works, but it's not thread-safe.
1616
_library = new Library();
1717
}
1818

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/LazyInitializationExample/LazyInitializationExecutor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BuildingBlocks;
1+
using System;
2+
using BuildingBlocks;
23

34
namespace LazyLoadLibrary.LazyInitializationExample
45
{
@@ -9,9 +10,11 @@ public static void Execute()
910
ConsoleExtension.WriteSeparator("Lazy initialization example");
1011

1112
var college = new LazyCollege();
13+
Console.WriteLine("Give me more details about the college!");
1214
college.ShowDetails();
1315

1416
var dotNetCollege = new DotNetLazyCollege();
17+
Console.WriteLine("\nGive me more details about the college!");
1518
dotNetCollege.ShowDetails();
1619
}
1720
}

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/Library.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public class Library
66
{
77
public Library()
88
{
9+
Console.WriteLine("Loading library...");
10+
911
Name = "Library";
1012
EstablishmentDate = new DateTime(2012, 5, 25);
1113
Address = "3537 Wood Street, Saginaw";

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/ValueHolderExample/LibraryLoader.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
using System;
2-
3-
namespace LazyLoadLibrary.ValueHolderExample
1+
namespace LazyLoadLibrary.ValueHolderExample
42
{
53
public class LibraryLoader : IValueLoader<Library>
64
{
75
public Library Load()
86
{
9-
Console.WriteLine("Loading library...");
107
return new Library();
118
}
129
}

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/ValueHolderExample/ValueHolder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
/// <summary>
44
/// A value holder is a generic object that handles the lazy loading behavior
55
/// and appears in place of the object’s data fields.
6-
/// When clients needs to access it, they simply ask the value holder for its value.
7-
/// That is the moment, when the value gets loaded (from a database or similar source).
6+
/// When clients need to access it, they simply ask the value holder for its value.
7+
/// That is the moment when the value gets loaded (from a database or similar source).
88
/// </summary>
99
/// <typeparam name="T">Value type.</typeparam>
1010
public class ValueHolder<T>

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/ValueHolderExample/ValueHolderCollege.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public ValueHolderCollege(int id)
1313
{
1414
Id = id;
1515

16-
// Value holder is usually injected through the constructor
16+
// Value holder is usually injected through the constructor.
1717
_library = new ValueHolder<Library>(new LibraryLoader());
1818

1919
Console.WriteLine("College initialization completed.");

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/ValueHolderExample/ValueHolderExecutor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BuildingBlocks;
1+
using System;
2+
using BuildingBlocks;
23

34
namespace LazyLoadLibrary.ValueHolderExample
45
{
@@ -11,6 +12,7 @@ public static void Execute()
1112
var collegeFactory = new CollegeFactory();
1213
var college = collegeFactory.CreateFromId(1);
1314

15+
Console.WriteLine("Give me more details about the college!");
1416
college.ShowDetails();
1517
}
1618
}

src/AdditionalPatterns/LazyLoad/LazyLoadLibrary/VirtualProxyExample/ProxyCollege.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public override Library Library
1616
{
1717
if (base.Library == null)
1818
{
19-
Console.WriteLine("Loading library...");
2019
base.Library = new Library();
2120
}
2221

0 commit comments

Comments
 (0)