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

Activities of "cosmic"

If you mean this

public override string? Name { get; set; }

then it doesn't work. Only non-nullable value type could be underlying of System.Nullable.

Hello, is it possible to set the User.Name and User.Surname as optional? How can I achieve this? Currently both are marked as Required. I need only UserName and EmailAddress to be required.

I have tried to override and to create new properties without Required attribute in a User class, but without success.

public class User : AbpUser<Tenant, User>
{
    ...
    public override string Name { get; set; }  // Not working
    ...
    public new string Name { get; set; }  // Not working
    ...
}

I have also tried to set properties as nullable through the EF Fluent API.

modelBuilder.Entity<User>().Property(e => e.Name).IsOptional();  // Not working

It will always return an exception:

Abp.Web.Mvc.Controllers.AbpHandleErrorAttribute|System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
Answer

I resolved problem with DataTables and pagination on server side.

Here is a working code:

var tableData = {
    draw: 0,
    recordsTotal: 0,
    recordsFiltered: 0,
    data: []
};
$("#datatable_auditlogs").DataTable({
    processing: true,
    serverSide: true,
    columns: [
        { data: 'id' },
        { data: 'tenantId' },
        { data: 'userId' },
        { data: 'serviceName' },
        { data: 'methodName' },
        { data: 'parameters' },
        { data: 'executionTime' },
        { data: 'executionDuration' },
        { data: 'clientIpAddress' },
        { data: 'clientName' },
        { data: 'browserInfo' },
        { data: 'exception' },
    ],
    ajax: function (data, callback, settings) {
        abp.services.app.auditLog.getPaged({
            skipCount: data.start,
            maxResultCount: data.length
        }).done(function (result) {
            tableData.draw = data.draw;
            tableData.recordsTotal = result.totalCount;
            tableData.recordsFiltered = result.totalCount;
            tableData.data = result.items;
            callback(tableData);
        });
    }
});
Answer

Thanks for response, but it is not working.

As you said, DataTables is hard to use, I agree. I have some other issues with it. I found the Bootstrap Table. It is much simpler than DataTables.

jTable is great, but it doesn't have support for Bootstrap theme and this will result on inconsistent UI style.

Question

Hi, anybody has an example to properly load data by the dynamic web API into the DataTables? I need server-side processing with pagination and filtering support.

Here is the JavaScript code I have played with:

var tableData = {
    draw: 1,
    recordsTotal: 0,
    recordsFiltered: 0,
    data: []
};
$("#datatable_auditlogs").DataTable({
    processing: true,
    serverSide: true,
    ajax: function (data, callback, settings) {
        abp.services.rioclub.auditLog.getPaged({
            skipCount: data.start,
            maxResultCount: data.length
        }).done(function (result) {
            tableData.recordsTotal = result.totalCount;
            tableData.recordsFiltered = result.totalCount;
            tableData.data = result.items;
        });
        callback(
            JSON.parse(tableData)
        );
    }
});

Above code is not working. I'll be appreciative for any help.

Hi, I'm working on similar solution right now. I followed this tutorial: <a class="postlink" href="http://bitoftech.net/2014/12/15/secure-asp-net-web-api-using-api-key-authentication-hmac-authentication/">http://bitoftech.net/2014/12/15/secure- ... ntication/</a>, maybe will help you. I don't have this fully implemented yet, but it looks much simpler than Bearer token authentication.

Actually it works with my static Web API, as I wrote before. With dynamically created Web API, Swagger only generate following docs:

GET - /api/AbpServiceProxies
POST - /api/AbpServiceProxies

GET - /api/ServiceProxies
POST - /api/ServiceProxies

I spent many time with configuration of Swagger, but I was unsuccessful with dynamic Web API. Maybe someone will figure it out with help of tutorials I posted before.

Hi, I have this app service:

public ListResultOutput<RecordDto> GetAllFilter(Expression<Func<Record, bool>> predicate)
{
    var items = _recordRepository.GetAllList(predicate);

    return new ListResultOutput<RecordDto>
    {
        Items = items.MapTo<List<RecordDto>>()
    };
}

I tried call this service from JavaScript code, but it didn't work:

abp.services.app.record.getAllFilter(function(r){
    return r.recordType = 20;
}).done(function (data) {
    for (var i = 0; i < data.items.length; i++) {
        records.push([i, data.items[i].points]);
    }
});

How I can call this service from JavaScript code right way? Is it possible?

Hi, maybe this will help you:

<a class="postlink" href="http://bitoftech.net/2014/08/25/asp-net-web-api-documentation-using-swagger/">http://bitoftech.net/2014/08/25/asp-net ... g-swagger/</a> <a class="postlink" href="http://www.strathweb.com/2014/04/opt-opt-asp-net-web-api-help-page/">http://www.strathweb.com/2014/04/opt-op ... help-page/</a>

I followed these manuals and the Swagger is fully functional for my Web API. It should work for you too.

Answer

Hi, I changed this method to "normal" sync method and I tested it again. But, the error is the same. I think this is not only problem of an async implementation, there may be a global problem (somewhere deeper in the ABP framework code) to catch exceptions right way.

I'm using Multi Page Application, not Angular, Durandal, etc. Please test this example and you should get the same result.

Thank you.

By the way, this framework is great, it saved me a lot of time, I appreciate all of your work, keep going...

Showing 11 to 20 of 27 entries