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

Activities of "rickwheeler"

I think I figured it out.

Make a custom Repository in the EfCore project like this

public class MyEntityRepository :MyAppRepositoryBase<MyEntity>, IRepository<MyEntity>
{
    public MyEntityRepository(IDbContextProvider<MyAppDbContext> dbContextProvider) : base(dbContextProvider) { }

    public override IQueryable<MyEntity> GetAll()
    {
        return base.GetAll().Include(x => x.MyRelatedEntity);
    }
}

Then in the PreInitialize method of EntityFrameworkCoreModule

Configuration.ReplaceService<IRepository<MyEntity>, MyEntityRepository>();

Thank you. I was able to figure out what these were via SQL schema compare but it is good to have it confirmed.

I also was able to figure out that if you follow the process below, you can create migrations to handle this upgrade

  • Remove all code from the up and down methods of the Initial_Migration.cs
  • run update-database
  • Delete all the code from the Initial_Migration.Designer.cs and the DbContextModelSnapshop.cs related to the tables and columns you mentioned above
  • Run add-migration V340ToV400
  • This migration should include the code to add the missing tables and columns
  • Add the following code to the bottom of the up method to set the normalized fields to the correct values
migrationBuilder.Sql("UPDATE AbpUsers SET NormalizedUserName = UPPER(UserName)");
migrationBuilder.Sql("UPDATE AbpUsers SET NormalizedEmailAddress = UPPER(EmailAddress)");
migrationBuilder.Sql("UPDATE AbpRoles SET NormalizedName = UPPER(Name)");
  • run update-database

Hi,

It is related.

It is to do with the way you are registering the routes and the order that they are registered in.

The problem is that by adding a catch all route inside of the RouteConfig.cs of the web project. It gets registered BEFORE the dynamic API routes.

Here is how I resolved the issue.

Step 1: Add a catch all route in the PostInitialize method. This will ensure that it is registered AFTER all others.

public override void PostInitialize()
        {
            var server = HttpContext.Current.Server;
            var appFolders = IocManager.Resolve<AppFolders>();

            appFolders.SampleProfileImagesFolder = server.MapPath("~/Common/Images/SampleProfilePics");
            appFolders.TempFileDownloadFolder = server.MapPath("~/Temp/Downloads");
            appFolders.WebLogsFolder = server.MapPath("~/App_Data/Logs");
            
            try { DirectoryHelper.CreateIfNotExists(appFolders.TempFileDownloadFolder); } catch { }

            // Register catch all here
            RouteTable.Routes.MapRoute(
                "CatchAll",
                "{*urlString}",
                new { controller = "CatchAll", action = "Index" }
            );
        }

Step 2: Update RouteConfig.cs with the following. We need to comment out the default route, map attribute routes and add explicit routes for scripts and views controllers

public static class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // Map attribute routes
            routes.MapMvcAttributeRoutes();

            //ASP.NET Web API Route Config
            routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            routes.MapRoute(
                "Home",
                "",
                new { controller = "Page", action = "Home" }
            );

            // Add explicit routes for some ABP controllers that were being handled by the now commented out default route
            routes.MapRoute(
                "AbpScripts",
                "AbpScripts/{action}",
                defaults: new { controller = "AbpScripts" },
                namespaces: new [] { "Abp.Web.Mvc.Controllers" }
            );

            routes.MapRoute(
                "AbpAppView",
                "AbpAppView/{action}",
                defaults: new { controller = "AbpAppView" },
                namespaces: new[] { "Abp.Web.Mvc.Controllers" }
            );

            // Comment out old default route in order to define explicit attribute routes
            //routes.MapRoute(
            //    name: "Default",
            //    url: "{controller}/{action}/{id}",
            //    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            //    namespaces: new[] { "ProductsOnline.Web.Controllers" }
            //);
            
        }
    }

Step 3: Go through all Controllers and define explicit attribute routes as follows

[AbpMvcAuthorize]
    // Add explicit attribute routing
    [Route("profile/{action}/{id?}")]
    public class ProfileController : ProductsOnlineControllerBase
    {

<cite>exlnt: </cite> That file is already there. I updated the bundle reference to use "Darkblue" so that resolved the color issue. The menu still does not work. It will not expand when you click on it. Can you help me with that?

To fix this issue you need to edit YourApplication.Web>App>common>views>layout>sidebar.cshtml

You need to change this

<a href="javascript:;" class="auto" ng-if="childMenuItem.items.length">

To this

<a href="javascript:;" class="auto nav-link nav-toggle" ng-if="menuItem.items.length">

Okay great. Thanks for the quick reply!

Hi,

Thanks for your help. I can confirm that both of these issues are resolved.

#2 was because the database was refreshed and I forgot to set my time-zone again.

Regards, Sean

You may also like to add a unique index to the table on Name + EditionId + TenantId

Can you please provide an example of how to do this for organization unit?

In case anyone is in need of help on this, I solved my connection issue by changing my server name to "(localdb)\ProjectsV13":

&lt;add name=&quot;Default&quot; connectionString=&quot;Server=(localdb)\ProjectsV13; Database=FreightHub; Trusted_Connection=True;&quot; providerName=&quot;System.Data.SqlClient&quot; /&gt;

It's not ideal since VS2015 introduced non-versioned database connections, but helped me get started with the framework until I find the cause of the issue.

Hi, I've just recently discovered ASP.NET Boilerplate and super excited about the potential. I'm also looking some additional features you described, including the following:

  1. ASPnetzero framework - <a class="postlink" href="http://www.aspnetzero.com/">http://www.aspnetzero.com/</a> a) Self Registration of organisation – Multi tenant, multi page. b) User Management by Admin users c) General Admin and payment etc.
  2. Metronic - <a class="postlink" href="http://www.keenthemes.com/preview/metro">http://www.keenthemes.com/preview/metro</a> ... ard_3.html
  3. SignalR - <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/">http://www.aspnetboilerplate.com/Pages/</a> ... ntegration
  4. Payment gateway to create invoices, and manage recurring payments eg Paypal.

The mapping stuff is of interest too but not an immediate requirement. We're looking at Stripe for the payment gateway or maybe something like Chargify - still not decided. If you're interested in potentially developing something together and sharing the costs then please reply to discuss further. Rick.

Showing 1 to 10 of 12 entries