static void Main(string[] args)
    {
        var factory = ReminderFactory <InvoiceSummary> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName};{item.TotalAmount}"));
        Console.ReadKey();
    }
    static void Main(string[] args)
    {
        //Hp --> While creating factory instance, must pass concreate class type of T.
        var factory = ReminderFactory <InvoiceSummary> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
예제 #3
0
    static void Main(string[] args)
    {
        //Hp --> Note: While creating factory instance, must pass concreate class type of T.
        //var factory = ReminderFactory<InvoiceSummary>.GetReminder("Invoicing");
        //Hp --> Logic: Simplified version of creating factory instance by removing hard coded string (as shown in above line)
        var factory = ReminderFactory.GetReminder <InvoiceSummary>();
        var x       = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
    static void Main(string[] args)
    {
        //Hp --> Note: While creating factory instance we are passing interface type.
        var factory = ReminderFactory <IIdentifiableEntity> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());

        //Hp --> Note: While reading data we need to cast to corrsponding concreate class type.
        x.Cast <InvoiceSummary>().ToList().ForEach(item =>
                                                   Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
    static void Main(string[] args)
    {
        var factory = ReminderFactory <IIdentifiableEntity> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());
    }