Base solution for your next web application

Activities of "doubledp"

Question

I am going to use ASP.NET Zero framework for internal web based system and don't see much use for the landing page, would rather it go to web app upon start up.

What would be the best way to achieve this without modifying the current structure of the framework? I want to try and stick as much as possible to the way things are done in this framework, as I think it exceptional coding (hopefully I can code like that in a couple of years). Also it would make upgrading the code with new releases fairly pain free.

Is there any pitfalls with this approach?

Pardon the use of the incorrect terminology. Thank you very much for the help.

Question

How many levels of navigation is supported? It would appear that I can only dive 1 level.

The AppPermissionsProvider seems to cater for multi levels as they appear in the treemenu as defined in the code, but from the HTML point of view, it does not reflect the multi menu correctly as defined in the AppNavigationProvider.

I had a look at the Metronic demo and it does seem like you can dive 3 levels.

Is it just a case of amending the sidebar.cshtml in App\common\views\layout.cshtml?

Answer

It would appear that the only change required was as I predicted. For anybody interested I will include the code changes that I have made:

<div class="page-sidebar md-shadow-z-2-i  navbar-collapse collapse">
    
    
    
    
    
    
    <ul class="page-sidebar-menu" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" ng-class="{'page-sidebar-menu-closed': settings.layout.pageSidebarClosed}" ng-if="vm.menu.items.length">
        
        <li ng-repeat="menuItem in vm.menu.items" ui-sref-active="active" ng-class="{'start':$first}">
            <a ui-sref="{{menuItem.url}}" ng-if="!menuItem.items.length">
                <i class="{{menuItem.icon}}"></i>
                <span class="title">{{menuItem.displayName}}</span>
            </a>
            <a href="javascript:;" class="auto" ng-if="menuItem.items.length">
                <i class="{{menuItem.icon}}"></i>
                <span class="title">{{menuItem.displayName}}</span>
                <span class="arrow "></span>
            </a>
            <ul class="sub-menu" ng-if="menuItem.items.length">
                
                <li ng-repeat="childMenuItem in menuItem.items" ui-sref-active="active" ng-class="{'start':$first}">

                    <a ui-sref="{{childMenuItem.url}}" ng-if="!childMenuItem.items.length">
                        <i class="{{childMenuItem.icon}}"></i>
                        <span class="title">{{childMenuItem.displayName}}</span>
                    </a>
                    <a href="javascript:;" class="auto" ng-if="childMenuItem.items.length">
                        <i class="{{childMenuItem.icon}}"></i>
                        <span class="title">{{childMenuItem.displayName}}</span>
                        <span class="arrow "></span>
                    </a>
                    <ul class="sub-menu" ng-if="childMenuItem.items.length">
                        
                        <li ng-repeat="childOfChildMenuItem in childMenuItem.items" ui-sref-active="active" ng-class="{'start':$first}">
                            <a ui-sref="{{childOfChildMenuItem.url}}" ng-if="!childOfChildMenuItem.items.length">
                                <i class="{{childOfChildMenuItem.icon}}"></i>
                                <span class="title">{{childOfChildMenuItem.displayName}}</span>
                            </a>
                            <a href="javascript:;" class="auto" ng-if="childOfChildMenuItem.items.length">
                                <i class="{{childOfChildMenuItem.icon}}"></i>
                                <span class="title">{{childOfChildMenuItem.displayName}}</span>
                                <span class="arrow "></span>
                            </a>
                            <ul class="sub-menu" ng-if="childOfChildOfChildMenuItem.items.length">
                                
                                <li ui-sref-active="active" ng-repeat="childOfChildOfChildMenuItem in childOfChildMenuItem.items">
                                    <a ui-sref="{{childOfChildOfChildMenuItem.url}}">
                                        <span>
                                            <i class="sub-menu-icon {{childOfChildOfChildMenuItem.icon}}"></i>{{childOfChildOfChildMenuItem.displayName}}
                                        </span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>
</div>
Answer

No problem, glad to be making a contribution :D

Answer

There is a bug on the level 4 menu.. I have corrected it now. Here is the updated code:

<div class="page-sidebar md-shadow-z-2-i  navbar-collapse collapse">
    
    
    
    
    
    
    <ul class="page-sidebar-menu" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" ng-class="{'page-sidebar-menu-closed': settings.layout.pageSidebarClosed}" ng-if="vm.menu.items.length">
        
        <li ng-repeat="menuItem in vm.menu.items" ui-sref-active="active" ng-class="{'start':$first}">
            <a ui-sref="{{menuItem.url}}" ng-if="!menuItem.items.length">
                <i class="{{menuItem.icon}}"></i>
                <span class="title">{{menuItem.displayName}}</span>
            </a>
            <a href="javascript:;" class="auto" ng-if="menuItem.items.length">
                <i class="{{menuItem.icon}}"></i>
                <span class="title">{{menuItem.displayName}}</span>
                <span class="arrow "></span>
            </a>
            <ul class="sub-menu" ng-if="menuItem.items.length">
                
                <li ng-repeat="childMenuItem in menuItem.items" ui-sref-active="active" ng-class="{'start':$first}">

                    <a ui-sref="{{childMenuItem.url}}" ng-if="!childMenuItem.items.length">
                        <i class="{{childMenuItem.icon}}"></i>
                        <span class="title">{{childMenuItem.displayName}}</span>
                    </a>
                    <a href="javascript:;" class="auto" ng-if="childMenuItem.items.length">
                        <i class="{{childMenuItem.icon}}"></i>
                        <span class="title">{{childMenuItem.displayName}}</span>
                        <span class="arrow "></span>
                    </a>
                    <ul class="sub-menu" ng-if="childMenuItem.items.length">
                        
                        <li ng-repeat="childOfChildMenuItem in childMenuItem.items" ui-sref-active="active" ng-class="{'start':$first}">
                            <a ui-sref="{{childOfChildMenuItem.url}}" ng-if="!childOfChildMenuItem.items.length">
                                <i class="{{childOfChildMenuItem.icon}}"></i>
                                <span class="title">{{childOfChildMenuItem.displayName}}</span>
                            </a>
                            <a href="javascript:;" class="auto" ng-if="childOfChildMenuItem.items.length">
                                <i class="{{childOfChildMenuItem.icon}}"></i>
                                <span class="title">{{childOfChildMenuItem.displayName}}</span>
                                <span class="arrow "></span>
                            </a>
                            <ul class="sub-menu" ng-if="childOfChildMenuItem.items.length">
                                
                                <li ui-sref-active="active" ng-repeat="childOfChildOfChildMenuItem in childOfChildMenuItem.items">
                                    <a ui-sref="{{childOfChildOfChildMenuItem.url}}">
                                        <span>
                                            <i class="sub-menu-icon {{childOfChildOfChildMenuItem.icon}}"></i>{{childOfChildOfChildMenuItem.displayName}}
                                        </span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>
</div>

Could anyone provide some guidance on the best way to add a javascript library such as amCharts. Is this a manual process or do you do this through NuGet?

The steps to get this to work would seem to be: Download library, manually add script and css files to solution/Install library through NuGet Include script in ScriptPaths under App_Start/Bundling Include css in StylePaths under App_Start/Bundling Include dependency in app.js

Ideally I would like to be able to auto update these libraries when added, can you please direct me in applying best practice and how to achieve that?

I know that this question of at least a similar question has been asked before. I would like a little more clarity regarding this.

I will have 2 dbContext, 1 connecting to the LOB database and another connecting to a DW database. I have written stored procedures that aggregates data and is returned within the result set.

I would very much like to use entity framework to handle this for me, but I do not want import the tables within that database as I won't be using them directly. My guess is that I need to create entities that will be mapped to the result set of each stored procedure. Would this not create these entities as tables in the database? (This is not what I want)

I am a bit confused as to how to handle this, because I want the dynamic WebAPI functionality to still work and for the functionality to remain very similar as how things are currently being done.

Any guidance will be much appreciated.

Apologies for only replying now. The repositories is defined within the Entity Framework layer and the DTO's within the Application layer right?

Currently I have a 2nd dbContext class as per below:

using System.Data.Common;
using System.Data.Entity;
using Abp.EntityFramework;
using WebApplication.Storage;

namespace WebApplication.EntityFramework
{
    public class SecondDbContext : AbpDbContext
    {
        public virtual IDbSet<BinaryObject> BinaryObjects { get; set; }

        public SecondDbContext() 
            : base("Second")
        {

        }

        public SecondDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        public SecondDbContext(DbConnection dbConnection)
            : base(dbConnection, true)
        {

        }
    }
}

Then I have added another it's equivalent base repository class as per below:

using Abp.Domain.Entities;
using Abp.EntityFramework;
using Abp.EntityFramework.Repositories;

namespace WebApplication.EntityFramework.Repositories
{
    public abstract class SecondRepositoryBase<TEntity, TPrimaryKey> : EfRepositoryBase<SecondDbContext, TEntity, TPrimaryKey>
        where TEntity : class, IEntity<TPrimaryKey>
    {
        protected SecondRepositoryBase(IDbContextProvider<SecondDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }
    }

    public abstract class SecondRepositoryBase<TEntity> : SecondRepositoryBase<TEntity, int>
        where TEntity : class, IEntity<int>
    {
        protected SecondRepositoryBase(IDbContextProvider<SecondDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }
    }
}

Do I create a custom repositories for the stored procedures as per your suggestion for each module that I have?

What I don't understand is in a AppService the IRepository<Entity> is in the constructor that injects the repository accordingly. I assume that this resolved correctly because of the IDbSet<Entity> within the 1st DbContext class.

How does this then work if I won't have a entity in the newly created 2nd DbContext class?

Excuse my ignorance, this is fairly new to me and I would really like to understand how everything fits together.

Thank you Halil :D

I using the Angular version. I wonder if it possible to control the updating of the javascript libraries through npm?

What is your thoughts regarding this?

Showing 1 to 10 of 50 entries