mirror of https://github.com/dapr/quickstarts.git
removed dead legacy usings/code
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
This commit is contained in:
parent
fb7852ac49
commit
568d1aa1df
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Dapr.Actors;
|
||||
using Dapr.Actors;
|
||||
using Dapr.Actors.Client;
|
||||
using smartdevice.Interfaces;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace smartdevice;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using Dapr.Actors;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace smartdevice.Interfaces;
|
||||
public interface IController : IActor
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using Dapr.Actors;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace smartdevice.Interfaces;
|
||||
public interface ISmartDevice : IActor
|
||||
|
|
@ -27,7 +25,7 @@ public class SmartDeviceData
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Name: {this.Name}, Status: {this.Status}, Battery: {this.Battery}, Temperature: {this.Temperature},Location: {this.Location}, " +
|
||||
return $"Name: {this.Name}, Status: {this.Status}, Battery: {this.Battery}, Temperature: {this.Temperature}, Location: {this.Location}, " +
|
||||
$"FirmwareVersion: {this.FirmwareVersion}, SerialNo: {this.SerialNo}, MACAddress: {this.MACAddress}, LastUpdate: {this.LastUpdate}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
using Dapr.Actors;
|
||||
using Dapr.Actors.Runtime;
|
||||
using smartdevice.Interfaces;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace smartdevice;
|
||||
|
||||
|
|
@ -20,27 +17,6 @@ internal class ControllerActor : Actor, IController, IRemindable
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called whenever an actor is activated.
|
||||
/// An actor is activated the first time any of its methods are invoked.
|
||||
/// </summary>
|
||||
protected override Task OnActivateAsync()
|
||||
{
|
||||
// Provides opportunity to perform some optional setup.
|
||||
Console.WriteLine($"Activating actor id: {this.Id}");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called whenever an actor is deactivated after a period of inactivity.
|
||||
/// </summary>
|
||||
protected override Task OnDeactivateAsync()
|
||||
{
|
||||
// Provides Opporunity to perform optional cleanup.
|
||||
Console.WriteLine($"Deactivating actor id: {this.Id}");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set MyData into actor's private state store
|
||||
/// </summary>
|
||||
|
|
@ -69,6 +45,27 @@ internal class ControllerActor : Actor, IController, IRemindable
|
|||
return 70.0M;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called whenever an actor is activated.
|
||||
/// An actor is activated the first time any of its methods are invoked.
|
||||
/// </summary>
|
||||
protected override Task OnActivateAsync()
|
||||
{
|
||||
// Provides opportunity to perform some optional setup.
|
||||
Console.WriteLine($"Activating actor id: {this.Id}");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called whenever an actor is deactivated after a period of inactivity.
|
||||
/// </summary>
|
||||
protected override Task OnDeactivateAsync()
|
||||
{
|
||||
// Provides Opporunity to perform optional cleanup.
|
||||
Console.WriteLine($"Deactivating actor id: {this.Id}");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register MyReminder reminder with the actor
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -26,22 +26,3 @@ else
|
|||
app.MapActorsHandlers();
|
||||
|
||||
app.Run();
|
||||
|
||||
|
||||
// **The following deprecated code can be removed -- which uses Startup class to configure middlware:
|
||||
|
||||
// using Microsoft.AspNetCore.Builder;
|
||||
|
||||
// var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// var startup = new smartdevice.Startup(builder.Configuration);
|
||||
|
||||
// builder.Services.AddOptions(); //try this
|
||||
|
||||
// startup.ConfigureServices(builder.Services);
|
||||
|
||||
// var app = builder.Build();
|
||||
|
||||
// startup.Configure(app, app.Environment);
|
||||
|
||||
// app.Run();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
using Dapr.Actors;
|
||||
using Dapr.Actors.Runtime;
|
||||
using smartdevice.Interfaces;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace smartdevice;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
// **The following deprecated code can be removed -- see Program.cs minimal API code for Startup configuration
|
||||
// using Microsoft.AspNetCore.Builder;
|
||||
// using Microsoft.AspNetCore.Hosting;
|
||||
// using Microsoft.Extensions.DependencyInjection;
|
||||
// using Microsoft.Extensions.Hosting;
|
||||
|
||||
// namespace smartdevice
|
||||
// {
|
||||
// public class Startup
|
||||
// {
|
||||
|
||||
// public Startup(IConfiguration configuration)
|
||||
// {
|
||||
// Configuration = configuration;
|
||||
// }
|
||||
|
||||
// public IConfiguration Configuration { get; }
|
||||
|
||||
// public void ConfigureServices(IServiceCollection services)
|
||||
// {
|
||||
// services.AddActors(options =>
|
||||
// {
|
||||
// // Register actor types and configure actor settings
|
||||
// options.Actors.RegisterActor<SmokeDetectorActor>();
|
||||
// });
|
||||
// }
|
||||
|
||||
// public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
// {
|
||||
// if (env.IsDevelopment())
|
||||
// {
|
||||
// app.UseDeveloperExceptionPage();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // By default, ASP.Net Core uses port 5000 for HTTP. The HTTP
|
||||
// // redirection will interfere with the Dapr runtime. You can
|
||||
// // move this out of the else block if you use port 5001 in this
|
||||
// // example, and developer tooling (such as the VSCode extension).
|
||||
// app.UseHttpsRedirection();
|
||||
// }
|
||||
|
||||
// app.UseRouting();
|
||||
|
||||
// app.UseEndpoints(endpoints =>
|
||||
// {
|
||||
// // Register actors handlers that interface with the Dapr runtime.
|
||||
// endpoints.MapActorsHandlers();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Loading…
Reference in New Issue