Base solution for your next web application

Activities of "kythor"

Answer

stupid me, had to set default project to EntityFramework...

but now I get this error:

Unable to generate an explicit migration because the following explicit migrations are pending: [201501041229232_InitialCreate, 201501131916251_Added_IsStatic_To_Role, 201503011513570_ModuleZero_Upgrade_For_ISuspendable, 201503070820583_Converted_IsSuspended_To_IsActive, 201503111946269_Added_Tenant_Property_Annotations, 201503122019249_Tenant_Changed_To_FullAuditedEntity_From_AuditedEntity, 201503220907591_Added_ShouldChangePasswordOnNextLogin_To_AbpUser, 201503252020192_Added_AuditLog_To_AbpZero, 201503291617289_Added_Tenancy_Filters_To_Abp_Zero, 201504021549075_User_AndAuditLog_Data_Size_Changes, 201504051650417_AbpZero_Role_SoftDelete, 201504110952594_Added_StoredFile_Entity, 201504111928297_Renamed_StoredFile_To_BinaryObject, 201505011844158_UserLogin_Property_Restrictions, 201505011844467_Create_Indexes_For_Module_Zero_Tables, 201505162037045_Renamed_BinaryObject_Table, 201506061210411_Added_AuthenticationSource_To_User, 201506141245516_AuditLog_Made_MayHaveTenant, 201509080740102_ModuleZeroUpgrade_0_6_9, 201510060756191_Added_Edition_And_Features, 201510270717447_Added_ApplicationLanguage_Entit...]. Apply the pending explicit migrations before attempting to generate a new explicit migration.
Question

Hi,

I followed the steps as described here <a class="postlink" href="https://aspnetzero.com/Documents/Developing-Step-By-Step-MPA#creating-person-entity">https://aspnetzero.com/Documents/Develo ... son-entity</a>

When trying to do Add-Migration I get an error.

this is the error:

No migrations configuration type was found in the assembly 'TIB.TIBtv.Tests'

In the tutorial, adding tests is after "Add-Migration", so what am I missing?

thanks for the reply, but it's a bit confusing. To be clear, I'm using multi-tenancy. But only to be future proof. At this time, I will only be using the default tenant for my portal.

I want to users to be able to subscribe to a plan, after payment through Braintree, they will have access to certain parts of the portal.

So I need a table where I store the different subscription plans, a table to store the user-subscription-payment info. I could create a new permission for every plan, that's a good idea I think. But I need to be able to manage this information through the back end. And when a user has payed for a plan, it will automatically add a record to the user-sub-payment table and set the right permission.

Do I even need features or editions, can't I just add this custom functionality without using the aspnetzero infrastructure? Not that I really want to, but I need to work fast now...deadline is coming...

thanks for the reply, but I'm not sure if I need editions. This is what I try to setup:

I only need one tenant now, this is the main portal site. Here users can register. The portal is a video-on-demand, livestream site. much like livebasketball.tv, but for a domestic league. So the users should be able to subscribe to a plan (both one time and recurrent payments) and be able to view on-demand content and livestreams. I will be using Braintree as payment processor. Easy integration here.

So I'm thinking of building a new feature "subscriptions", adding this to the backend interface for administration purposes. On the frontend the only thing needed is a way to attach the SubscriptionId and payment info to a user.

I have allready started building the feature, using the new "chat feature" as reference, so I hope I'm on the right track here?

Answer

Yeah, just noticed this, the tables are gone now. Logging into the backend app throws an error for the chat app.

Should I run the Update-Database again?

I want my users to be able to buy a subscription on my site.

Am I correct if I say I need to add a new Feature for this?

Could you help me on my way to creating something like this?

Answer

It generated:

public partial class Upgrade_To_AspNetZero_111 : DbMigration
    {
        public override void Up()
        {
            DropTable("dbo.AppChatMessages",
                removedAnnotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_ChatMessage_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                });
            DropTable("dbo.AppFriendships",
                removedAnnotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_Friendship_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                });
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.AppFriendships",
                c => new
                    {
                        Id = c.Long(nullable: false, identity: true),
                        UserId = c.Long(nullable: false),
                        TenantId = c.Int(),
                        FriendUserId = c.Long(nullable: false),
                        FriendTenantId = c.Int(),
                        FriendUserName = c.String(nullable: false, maxLength: 32),
                        FriendTenancyName = c.String(),
                        FriendProfilePictureId = c.Guid(),
                        State = c.Int(nullable: false),
                        CreationTime = c.DateTime(nullable: false),
                    },
                annotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_Friendship_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.AppChatMessages",
                c => new
                    {
                        Id = c.Long(nullable: false, identity: true),
                        UserId = c.Long(nullable: false),
                        TenantId = c.Int(),
                        TargetUserId = c.Long(nullable: false),
                        TargetTenantId = c.Int(),
                        Message = c.String(nullable: false),
                        CreationTime = c.DateTime(nullable: false),
                        Side = c.Int(nullable: false),
                        ReadState = c.Int(nullable: false),
                    },
                annotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_ChatMessage_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                })
                .PrimaryKey(t => t.Id);
            
        }
    }
}

After that I ran the command "Update-Database" and reloaded the site. Bingo, no more error.

So in the future, I don't need the migration files you guys added?

Answer

If I do Add-Migration it asks for "Name"? Is this like "201606150821191_Added_Chat_And_Friendship_Entities"? And what does it do exactly?

I copied the new Chat and Friendship classes from the latest build source.

I always used Database First in the past, so this is new stuff for me.

Under \EntityFramework\Migrations\Configuration, AutomaticMigrationsEnabled is set to False. Would setting this to True help?

Answer

oops, my mistake, the code was missing indeed. It's working now, the Angular Grids are also working.

Now I want to upgrade the database. I'm using the Packet Manager Console and the command Upgrade-Database. This is the result:

Applying explicit migrations: [201606150821191_Added_Chat_And_Friendship_Entities, 201606161233356_Make_FriendShip_And_Chat_TenantId_Nullable, 201606220958138_Add_FriendUserName_To_Friendship_Table, 201606231022491_Add_TenancyName_And_ProfilePictureId_To_AppFriendships_Table, 201606240745029_Add_MayHaveTenant_Annotation_To_ChatMessage_And_Friendship, 201607211123175_Added_Validation_To_Chat_Entities].
Applying explicit migration: 201606150821191_Added_Chat_And_Friendship_Entities.
Applying explicit migration: 201606161233356_Make_FriendShip_And_Chat_TenantId_Nullable.
Applying explicit migration: 201606220958138_Add_FriendUserName_To_Friendship_Table.
Applying explicit migration: 201606231022491_Add_TenancyName_And_ProfilePictureId_To_AppFriendships_Table.
Applying explicit migration: 201606240745029_Add_MayHaveTenant_Annotation_To_ChatMessage_And_Friendship.
Applying explicit migration: 201607211123175_Added_Validation_To_Chat_Entities.
Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
You can use the Add-Migration command to write the pending model changes to a code-based migration.

If I look at the database the tables are created correctly. But I'm confused with the last statement "Unable to update database to match the current model". What does this mean, what do I need to do?

And now getting this error:

The model backing the 'TIBtvDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
Answer

I understand that it's not as straightforward as I first thougth, and merging all your changes in my project manually is actually a good thing, because I learn the structure of aspnetzero.

However, some problems, still persist, even after copying all changed code or layout files.

Most pressing issue now is why AbpSession is throwing an error? This is part of the Abp dll's, which I allready updated. Any help would be welcome.

Showing 111 to 120 of 129 entries