Example #1
0
        public IHttpActionResult GetReport1([FromBody] Options options)
        {
            List <Report> list = new List <Report>();

            using (var dataContext = new ADODBContext()) {
                list = dataContext.GetReportList(options);
            }
            return(Ok(list));
        }
Example #2
0
        static void Start()
        {
            ADODBContext database = new ADODBContext();

            using (database)
            {
                database.Database.CreateIfNotExists();
            }

            List <IExecutableTask> executableTasks = new List <IExecutableTask>();

            var         currentAssembly = Assembly.GetExecutingAssembly();
            List <Task> tasks           = new List <Task>();

            currentAssembly.GetTypes()
            .Where(t => t.Namespace == "ADO.net.Services" && t.GetInterface(nameof(IExecutableTask)) != null)
            .ToList()
            .ForEach(type => executableTasks.Add((IExecutableTask)currentAssembly.CreateInstance(type.FullName)));

            executableTasks
            .ForEach(s => Task.Run(() =>
            {
                Type type = s.GetType();
                foreach (MethodInfo method in type.GetMethods())
                {
                    if (method.DeclaringType.Name == type.Name)
                    {
                        ResetColor();
                        Out.Write($"\nExecuting");

                        ForegroundColor = ConsoleColor.Yellow;
                        Out.Write($" {method.Name} ");

                        ResetColor();
                        Out.Write($"from");

                        ForegroundColor = ConsoleColor.Yellow;
                        Out.WriteLine($" {type.Name}");

                        ResetColor();

                        method.Invoke(s, null);
                    }
                }
            }).Wait()
                     );
        }