Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "fguo"

I am trying ASPNet Core & Angular 4.4.0. The Web.Public project is MVC version. When I publish it, it deploys with all other projects. Do we have an Angular 2 version of Web.Public available? :?:

The reason I am asking is that, I need to build a separate Angular2 SPA for non-admin users. Similar to the Web.Public, the user needs to click the "Login" on that SPA for authentication. I can make a link to direct the login request on admin site: <a href="adminSite/account/login??ss=true&returnUrl=userSite/home">Login</a>

After the authentication, there must be a response body redirected back to the user site and start the session, I guess. What json object is in the "response body"? How do I access the "response body" to get session info, such as user-name? :?:

Can you give me a brief sample code?

Thanks,

"WhereIf" is handy in scenario of multiple input items, and it works fine with small data, as my test. However, it seems something wrong when I recently worked with a database table with about 100 columns and 200k records. The table is named as "Worksheets". I am trying to make a "GetWorksheets" service. The code likes:

    public ListResultDto&lt;WorksheetListDto&gt; GetWorksheets(GetWorksheetsInput input)
    {
        var worksheets = _worksheetRepository
            .GetAll()
            //.Where(w=> (input.WorksheetIds != null && input.WorksheetIds.Any() && input.WorksheetIds.Contains(w.Id)))
            .WhereIf((input.WorksheetIds != null && input.WorksheetIds.Any()), w => input.WorksheetIds.Contains(w.Id))
            .OrderBy(w => w.Id)
            .ToList();
        return new ListResultDto&lt;WorksheetListDto&gt;(ObjectMapper.Map&lt;List&lt;WorksheetListDto&gt;>(worksheets));
    }

It takes about 3 minutes to return a result for a single Id in input, while I test it on Swagger.

I tried to replace the "WhereIf" with a regular "Where" (the comment out line above). It only takes 2 seconds to return a result.

Why the "WhereIf" is so slow? Did I miss something to use it?

Thanks,

I need to persist an entity instance into database table. The table has columns with default constraint. When I directly run a sql insert statement, the default values correctly inserted. However, if I insert the entity by IRepository.InsertAndGetIdAsync(), the default values are always null or DBNull.

For example, a table with 3 int type columns: T.col1, T.col2, and T.col3. The T.col2 is nullable and has a default constraint of value 2, and T.col3 is not allowed null and has default constraint of value 3.

If I run insert statement: insert into T (col1) values (1) It results correctly as col1=1, col2=2, and col3=3.

When I use IRepository.InsertAndGetIdAsync() like:

var t=new T(); t.col1=1; IRepository<T>.InsertAndGetIdAsync(t);

The data table in database inserts a record with values of col1=1, col2=NULL, col3=0.

It likes that the IRepository<T>.InsertAndGetIdAsync(t) does not respect the database rule. What do I miss?

Thanks,

I am trying Core+Angular v4.2.1. It works fine on localhost, but cannot open Swagger UI after deployed on server. It shows "An error occurred while starting the application" . The Log file records a FATAL error:

Abp.AbpBootstapper - System.Exception: Could not find content root folder!

I traced the code file (*.Core\Web\WebContentFolderHelper.cs) which contains this exception message, but can't get any clue. My last version v4.0 has no such problem. It deployed same way on same IIS folder with same with same appsettings.

I have verified that the production database has no problem. I can connect it from localhost.

Do you have any idea/clue/suggestion?

Thanks,

I sometime need to response an error message and assign an error code to reject a HTTP request. For example, there is an AddPhoneNumber method in the phonebook example. If the input phone number in HTTP POST request is in our blocked list, I need to reject the POST request with Error code 401 and a message of "Blocked Phone Number". How do I implement it? Do you have a similar example?

Thanks,

I am trying to provide an API to insert a parent object with children objects. For testing, I modified a little from the phonebook example, but it always throws out System.NullReferenceException: Object reference not set to an instance of an object.

Here is my code:

    public async Task&lt;PhoneInPersonListDto&gt; AddPhone(AddPhoneInput input)
    {
        var person = new Person();
        person.Name = "x";
        person.Surname = "y";

        var phone = ObjectMapper.Map&lt;Phone&gt;(input);
        person.Phones.Add(phone);

        var personId = await _personRepository.InsertAndGetIdAsync(person);

        return ObjectMapper.Map&lt;PhoneInPersonListDto&gt;(phone);
    }

Can you advise what I missed?

Thanks,

I noticed that most entity properties are defined as "public virtual ..." in Phonebook example and other code. As my understanding, "virtual" is for lazy loading or overwriting in derived classes. So, it is useful to define "virtual" on navigation properties (e.g. public virtual ICollection<Phone> Phones { get; set; }). What is the purpose to define all other entity properties as "virtual" (e.g. public virtual string Name { get; set; })? Does it effect performance on large DB tables?

Thanks,

I am trying Core + angular v4.1.3. There is a new project Web.Public. I set it as Startup Project and run. It opens a public website on localhost:45776. Looks good. When I click the Login on this website, it redirects to localhost:4200/account/login?ss=true&returnUrl=http://localhost:45776/Account/Login, and pops up an error: "An errorhas occurred! Error detail not sent by server." :(

I tried to change the "remoteServiceBaseUrl": "http://localhost:45776" on angularUI/src/assets/appconfig.json, yarn and npm start again, and direct open localhost:4200. It always pops up the same error. What did I miss? :?:

If I set *.Web.Host as Startup Project, and run AngularUI at localhost:4200, it works fine, just like v4.0 before.

The document seems not updated. I couldn't find any topic about Web.Public from the document.

Please advise!

Thanks,

The version 4.1 released. I want to update it from my current 4.0 version. I've already added my code files or modified some code on version 4.0. What is the best way for me to update to 4.1 but keep my own modification on 4.0?

Thanks,

I am trying "ASP.NET Core & Angular" version 4.0. After publishing on IIS, it works as expected on Chrome and Edge, but it shows a blank page on IE 11. When start it on IE 11, I can see the "circle" spinning a second and the background color changed, but the login boxes don't show up.

I tried to use IE 11 to open server side swagger. It works fine.

I tried to use IE 11 in local environment. it works as normal. The only different are:

  1. I removed the <staticContent> section from the web.config on IIS.
  2. The value of "appBaseUrl" is "http://localhost:4200" in local environment. It is "http://subdomain.mydomain.com" in IIS hosting.

Any idea?

Thanks,

Showing 51 to 60 of 76 entries