Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
IDateTimeUtility をサービス化
Browse files Browse the repository at this point in the history
  • Loading branch information
Takym authored and keiji committed Nov 21, 2021
1 parent 9437b64 commit c496a3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Covid19Radar/Covid19Radar/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

Expand Down Expand Up @@ -173,6 +173,7 @@ private static void RegisterCommonTypes(IContainer container)
{
// Services
container.Register<IUserDataRepository, UserDataRepository>(Reuse.Singleton);
container.Register<IDateTimeUtility, DateTimeUtility>(Reuse.Singleton);
container.Register<ILoggerService, LoggerService>(Reuse.Singleton);
container.Register<ILogFileService, LogFileService>(Reuse.Singleton);
container.Register<ILogPathService, LogPathService>(Reuse.Singleton);
Expand Down
16 changes: 8 additions & 8 deletions Covid19Radar/Covid19Radar/Common/DateTimeUtility.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using System;
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

using System;

namespace Covid19Radar.Common
{
public interface IDateTimeUtility
{
DateTime UtcNow { get; }
public DateTime UtcNow { get; }
}

public class DateTimeUtility : IDateTimeUtility
{
public static IDateTimeUtility Instance = new DateTimeUtility();

public DateTimeUtility()
{
}

public DateTime UtcNow => DateTime.UtcNow;
}
}

0 comments on commit c496a3b

Please sign in to comment.