Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string       PATH      = "User.dicon";
            IS2Container container = S2ContainerFactory.Create(PATH);
            IUserDao     userDao   = (IUserDao)container.GetComponent(typeof(IUserDao));

            Console.WriteLine("List of all users: ");
            IList <UserDto> list = userDao.GetAll();

            foreach (UserDto usr in list)
            {
                Console.Write(usr.Id + " ");
                Console.Write(usr.Name + " ");
                Console.WriteLine(usr.Age);
            }

            Console.WriteLine("Get user info by Id = 1");
            UserDto user = userDao.GetData(1);

            Console.Write(user.Id + " ");
            Console.Write(user.Name + " ");
            Console.WriteLine(user.Age);

            Console.WriteLine("Get user info by name = 'B' and age = 8");
            IList <UserDto> userList = userDao.GetUsersByNameAndAge("B", 8);

            foreach (UserDto usr in userList)
            {
                Console.Write(usr.Id + " ");
                Console.Write(usr.Name + " ");
                Console.WriteLine(usr.Age);
            }

            Console.ReadLine();
        }
Ejemplo n.º 2
0
    public static void Main(string[] args)
    {
        IS2Container s2c = S2ContainerFactory.Create(PATH);

        Data2 data = s2c.GetComponent("data3") as Data2;

        Console.WriteLine("id : {0}", data.LinkData.Id);
    }
Ejemplo n.º 3
0
    public static void Main(string[] args)
    {
        IS2Container s2c = S2ContainerFactory.Create(PATH);

        DataProcessor processor = s2c.GetComponent("processor") as DataProcessor;

        processor.Process();
    }
Ejemplo n.º 4
0
    public static void Main(string[] args)
    {
        IS2Container s2c = S2ContainerFactory.Create(PATH);

        IData data1 = s2c.GetComponent(typeof(IData)) as IData;

        Console.WriteLine("---- GetComponent(typeof)------");
        PrintData(data1);

        IData data2 = s2c.GetComponent("data") as IData;

        Console.WriteLine("---- GetComponent(data)------");
        PrintData(data2);

        IData data3 = (s2c.GetComponent("wrapper") as DataWrapper).Target;

        Console.WriteLine("---- wrapper ------");
        PrintData(data3);
    }