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

Activities of "bilalhaidar"

Hi, I am looking at similar Razor views in the solution to see how to populate a select with live search. Below is the code. The problem is the select control is never populated, instead it shows "Nothing Selected".

I made sure data is returned from server. I can see them on the Chrome Developer Tool.

Thanks

View:

<select class="form-control bs-select" name="Shelter" id="Shelter" ng-model="vm.poc.shelter"
                        ui-jq="selectpicker"
                        data-live-search="true">
                    <option ng-repeat="shelter in vm.shelters"
                            value="{{shelter.id}}">{{shelter.label}}
                    </option>
                </select>
                <label>@L("Shelter")</label>

Controller:

vm.shelters = [];
vm.init = function () {
                vm.loading = true;
                commonLookupService.getReferenceTables().then(function (result) {
                    vm.shelters = result.data.shelters;
                }).finally(function () {
                    vm.loading = false;
                });
            }

            vm.init();

Hi, In the documentation it says the following.

So, if we are retrieving data for entities that have IMustHaveTenant, do we need to call SetTenantId explicitly? Isn't that retrieved from Session. Or is it a must to always call SetTenantId?

Thanks

Switching Between Host and Tenants
While working on a multitenant application database, we should know the current tenant. By default, it's obtained from IAbpSession (as described before). We can change this behaviour and switch to other tenant's database. Example:

public class ProductService : ITransientDependency
{
    private readonly IRepository<Product> _productRepository;
    private readonly IUnitOfWorkManager _unitOfWorkManager;

    public ProductService(IRepository<Product> productRepository, IUnitOfWorkManager unitOfWorkManager)
    {
        _productRepository = productRepository;
        _unitOfWorkManager = unitOfWorkManager;
    }

    [UnitOfWork]
    public virtual List<Product> GetProducts(int tenantId)
    {
        using (_unitOfWorkManager.Current.SetTenantId(tenantId))
        {
            return _productRepository.GetAllList();
        }
    }
}
SetTenantId ensures that we are working on given tenant data, independent from database architecture:

If given tenant has a dedicated database, it switches to that database and gets products from it.
If given tenant has not a dedicated database (single database approach, for example), it adds automatic TenantId filter to query get only that tenant's products.
If we don't use SetTenantId, it gets tenantId from session, as said before.

Hi,

I have a set of data that is stored per Tenant.

When I logging in under Host Admin, I try to access that data, I set this:

List<Shelter> shelters;
            shelters = await _shelters.Shelters.OrderBy(s => s.ShelterCode).ToListAsync();

I get all the data. The data is all stored with a TenantId = 1.

So, when I am logging in as Admin Host, the tenant Id should be null.

How come the data is retrieved?

Am I missing something here?

This is the WHERE clause in SQL after using SQL Profiler:

WHERE 
	(
		([TenantId] = 0) OR ( CAST( [TenantId] AS int) IS NULL) OR (1 IS NOT NULL)
	) AND 
		(([IsDeleted] = 0) )

1 IS NOT NULL always true, hence all data are returned. But why do I have that additional filter?

Thanks Bilal

Hello,

If I want to organize my code in solution folders, where every solution folder has its own .Core, .Application, .EntityFramework.

Do you have a VS template to create a new module?

For instance, if I want my ModuleX to define some permissions, am I supposed to only added them in the main .Core project, or I can add them in the .Core of my ModuleX?

Reason, why I am asking for this is, I want to keep the framework code untouched and do my work in some other modules, so that I might have it easier to upgrade the framework code when a new release is out.

Thanks Bilal

Hello, I am facing a very complicated scenario here.

I login as admin of Default Tenant. (Id = 1)

Then, I have a table lets call it Events (Stored per Tenant). On the Event record there is Location (Stored as ID on Event record and refers to the ID of a Location).

Location data (I have several locations stored in the system) as stored as tenant-unaware (Saved in Host). Why? Because Locations are shared by all tenants.

Now in my query to return an Event including Location Name, I have to LEFT OUTER JOIN with Location table.

However, I am always getting NULL for the Location Name.

I believe I know what's happening. The query is adding additional filter on Tenant Id.

I have the code something as:

from e in _eventsRepo.GetAll() 
join l in _locationsRepo.GetAll() on e.LocationId equals l.Id into JoinLocations
from lo in JoinLocations.DefaultIfEmpty()
select new {
  EventId = e.Id,
  EventLocation = lo.LocationName
}

The above always returns null for LocationName.

Again, Locations are stored per host, while events are stored per tenant.

I am sure you passed through this before, I truly appreciate your feedback.

Regards Bilal

Hello,

I am trying to find the code where the triggered event AbpHandledExceptionData is being handled?

If possible to refer me to source code.

Thank you. Bilal

Hello,

I am browsing the framework code and noticed this code:

public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager)
        {
            _settingDefinitionManager = settingDefinitionManager;

            AbpSession = NullAbpSession.Instance;
            SettingStore = DefaultConfigSettingStore.Instance;

As you can see it is using the DefaultconfigSettingStore.

Later on, in the Abp.Zero, it defines a new SettingStore.

Where in the solutions, you configure it to use the Abp.Zero.SettingStore and not the default?

Also, every module can have a SettingsProvider to return Settings. Where in the solutions, do you capture all those settings from each module and store them in db?

Many thanks, Bilal

Hi, I am a bit stuck here.

When sending DateTime values to server, should I do anything special on client side? Like convert the dates to some format or use moment or ?

On the server, I can then use Clock.Normalize(Convert.ToDateTime('Date From Client')) to store the value in UTC in the DB?

On some entities, when I return them to client I notice the CreationTime is "2017-03-09T00:41:42.647Z" for example. I guess, the CreationTime is stored in UTC, so how could I return my values from server in that format?

I am a bit confused in here.

Appreciate your help.

Bilal

Hello, Now that a new release of the framework is out. How can I get latest changes and add them to my existing solution? I read somewhere it is not intended to be an upgradable framework, but given the fact there are new features and enhancements why not make use of them for my existing solution?

Thanks Bilal

Hi, I noticed now that there is an AngularJs version of Metronic. Are you using it? <a class="postlink" href="http://keenthemes.com/preview/metronic/theme/admin_4_angularjs/index.html#/dashboard.html">http://keenthemes.com/preview/metronic/ ... board.html</a>

Or which one are you using?

regards Bilal

Showing 131 to 140 of 174 entries