<?xml version= "1.0" encoding="utf-8" ?>
<StructureMap >
<Assembly Name="ConsoleApplication4" />
<PluginFamily Assembly= "ConsoleApplication4" Type="ConsoleApplication4.IScheduler " DefaultKey="MyFirstScheduler">
<Instance Type= "Daily" Key="MyFirstScheduler" />
</PluginFamily >
</StructureMap>
using System;
using System.Data;
using StructureMap;
namespace ConsoleApplication4
{
[Pluggable( "Daily")]
public class DailyScheduler : IScheduler
{
public DateTime GetNextRunTime( DateTime currentTime)
{
return DateTime.Now;
}
}
public interface IScheduler
{
DateTime GetNextRunTime(DateTime now);
}
class Program
{
static void Main(string[] args)
{
IScheduler s = ObjectFactory.GetInstance<IScheduler>();
}
}
}
No comments:
Post a Comment