egarim / XpoWebApi-for-AspNetCore-GettingStarted

2 stars 0 forks source link

HttpStatusException: Non successful Http Status Code: 500. Request Uri: https://localhost:44318/api/XpoWebApi #2

Open valquavn opened 3 years ago

valquavn commented 3 years ago

HttpStatusException: Non successful Http Status Code: 500. Request Uri: https://localhost:44318/api/XpoWebApi

static void Main(string[] args) { //Console.WriteLine("Hello World!");

        //Register XpoWebApiProvider 
        XpoWebApiProvider.Register();

        var XpoWebApiAspNetCore = XpoWebApiProvider.GetConnectionString("https://localhost:44318/", "api/XpoWebApi", string.Empty, "ConnectionString");
        XpoInitializer xpoInitializer = new XpoInitializer(XpoWebApiAspNetCore, typeof(Department));

        xpoInitializer.InitSchema();

        //var UoW = xpoInitializer.CreateUnitOfWork();
        //Person JocheOjeda = new Person(UoW) { Name = "Jose Manuel Ojeda Melgar" };
        //Person RoccoOjeda = new Person(UoW) { Name = "Rocco Ojeda Melgar" };

        //if (UoW.InTransaction)
        //    UoW.CommitChanges();

        var unitOfWork = xpoInitializer.CreateUnitOfWork();
        var departments = unitOfWork.Query<Department>();  //new XPCollection<Department>(UoWRead);

        foreach (Department department in departments)
        {
            Console.WriteLine(department.DepartmentName);
        }
        Console.ReadKey();
    }

Exception here

    public IDataResult ExecuteFunction(IDataParameters Parameters)
    {
        var TaskValue = Task.Run(async () => await ExecuteFunctionAsync(Parameters));
        TaskValue.Wait();
        return TaskValue.Result;
    }