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

Activities of "bolenton"

Issue Resolved

Thanks

Does it work if you comment out ChangeAbpTablePrefix?

  • Yes Are you using the default migrations provided by Asp.Net Zero?
  • Yes Can you show what's in the __MigrationHistory table in your database?

MigrationId || ProductVersion 20170406083347_Initial_Migration || 2.0.1-rtm-125 20170623075109_AspNetZero_V4_1_Changes || 2.0.1-rtm-125 20170704084731_Added_GoogleAuthenticatorKey_Column || 2.0.1-rtm-125 20170714081027_Added_Relation_Between_Edition_And_SubscriptionPayment || 2.0.1-rtm-125 20170724142223_Upgraded_To_Abp_V2_2 || 2.0.1-rtm-125 20170913133916_Added_SharedMessageId_To_ChatMessage || 2.0.1-rtm-125 20170914070123_Added_ReceiverReadState_To_ChatMessage || 2.0.1-rtm-125 20170914084815_Invoice_Changes || 2.0.1-rtm-125 20170914121022_TypeChange_SharedMessageId_String_Guid || 2.0.1-rtm-125 20171128060602_Added_MoreFeildsTo_User_Entity || 2.0.1-rtm-125 20171128061636_Added_More_UserFeilds_Entity || 2.0.1-rtm-125

I did that first. I get the exact same error.

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.ChangeAbpTablePrefixAndPluralization<Tenant, Role, User>("");

    modelBuilder.Entity<MemberStatus>(b =>
    {
        b.HasIndex(e => new { e.TenantId });
    });

    modelBuilder.Entity<BinaryObject>(b =>
    {
        b.HasIndex(e => new { e.TenantId });
    });

    modelBuilder.Entity<ChatMessage>(b =>
    {
        b.HasIndex(e => new { e.TenantId, e.UserId, e.ReadState });
        b.HasIndex(e => new { e.TenantId, e.TargetUserId, e.ReadState });
        b.HasIndex(e => new { e.TargetTenantId, e.TargetUserId, e.ReadState });
        b.HasIndex(e => new { e.TargetTenantId, e.UserId, e.ReadState });
    });

    modelBuilder.Entity<Friendship>(b =>
    {
        b.HasIndex(e => new { e.TenantId, e.UserId });
        b.HasIndex(e => new { e.TenantId, e.FriendUserId });
        b.HasIndex(e => new { e.FriendTenantId, e.UserId });
        b.HasIndex(e => new { e.FriendTenantId, e.FriendUserId });
    });

    modelBuilder.Entity<Tenant>(b =>
    {
        b.HasIndex(e => new { e.SubscriptionEndDateUtc });
        b.HasIndex(e => new { e.CreationTime });
    });

    modelBuilder.Entity<SubscriptionPayment>(b =>
    {
        b.HasIndex(e => new { e.Status, e.CreationTime });
        b.HasIndex(e => new { e.PaymentId, e.Gateway });
    });

    modelBuilder.ConfigurePersistedGrantEntity();
}


public static void ChangeAbpTablePrefixAndPluralization<TTenant, TRole, TUser>(this ModelBuilder modelBuilder, string prefix, string schemaName = null, bool plural = true)
            where TTenant : AbpTenant<TUser>
            where TRole : AbpRole<TUser>
            where TUser : AbpUser<TUser>
        {
            prefix = prefix ?? "";

            var s = "";

            if (plural)
            {
                s = "s";
            }

            SetTableName<AuditLog>(modelBuilder, prefix + "AuditLogs", schemaName);
            SetTableName<BackgroundJobInfo>(modelBuilder, prefix + "BackgroundJobs", schemaName);
            SetTableName<Edition>(modelBuilder, prefix + "AbpEditions", schemaName);
            SetTableName<ApplicationLanguage>(modelBuilder, prefix + "Languages", schemaName);
            SetTableName<ApplicationLanguageText>(modelBuilder, prefix + "LanguageTexts", schemaName);
            SetTableName<NotificationInfo>(modelBuilder, prefix + "Notifications", schemaName);
            SetTableName<NotificationSubscriptionInfo>(modelBuilder, prefix + "NotificationSubscriptions", schemaName);
            SetTableName<OrganizationUnit>(modelBuilder, prefix + "Groups", schemaName);
            SetTableName<PermissionSetting>(modelBuilder, prefix + "Permissions", schemaName);
            SetTableName<RolePermissionSetting>(modelBuilder, prefix + "RolePermissions", schemaName);
            SetTableName<UserPermissionSetting>(modelBuilder, prefix + "MemberPermissions", schemaName);
            SetTableName<TRole>(modelBuilder, prefix + "Roles", schemaName);
            SetTableName<Setting>(modelBuilder, prefix + "Settings", schemaName);
            SetTableName<UserLogin>(modelBuilder, prefix + "MemberLogins", schemaName);
            SetTableName<UserLoginAttempt>(modelBuilder, prefix + "MemberLoginAttempts", schemaName);
            SetTableName<TenantNotificationInfo>(modelBuilder, prefix + "TenantNotifications", schemaName);
            SetTableName<UserNotificationInfo>(modelBuilder, prefix + "MemberNotifications", schemaName);
            SetTableName<UserOrganizationUnit>(modelBuilder, prefix + "MemberGroups", schemaName);
            SetTableName<UserRole>(modelBuilder, prefix + "MemberRoles", schemaName);
            SetTableName<TUser>(modelBuilder, prefix + "Members", schemaName);
            SetTableName<UserAccount>(modelBuilder, prefix + "MemberAccounts", schemaName);
            SetTableName<UserClaim>(modelBuilder, prefix + "MemberClaims", schemaName);
            SetTableName<RoleClaim>(modelBuilder, prefix + "RoleClaims", schemaName);
            SetTableName<UserToken>(modelBuilder, prefix + "MemberTokens", schemaName);
        }

        internal static void SetTableName<TEntity>(this ModelBuilder modelBuilder, string tableName, string schemaName) where TEntity : class
        {
            if (schemaName == null)
            {
                modelBuilder.Entity<TEntity>().ToTable(tableName);
            }
            else
            {
                modelBuilder.Entity<TEntity>().ToTable(tableName, schemaName);
            }
        }

table names are unchanged

it was during update database, So I wiped the database and started fresh by running the migrator console app. I get the same error.

When I run the command to remove the Table Name prefix, I get this error. Does anyone know what I am doing wrong? System.Data.SqlClient.SqlException: Invalid object name 'Editions'.

My issue is I get that error when I try to remove the Abp Prefix.

When ever I run this command I get this error. => System.Data.SqlClient.SqlException: Invalid object name 'Editions'.

I'm very interested. I'll wait to hear back from you.

Showing 11 to 20 of 26 entries