yes we are also facing the same exception
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
Hey abp team As we know when we create over a project we will get the identity model in that we have a user, and role management this is in my main database and I have another one model where I have the Candidate table which is in another database. in roles, i have a practitioner and i want to assign Practitioner to the Candidates
as we can see in the screenshot I have two models with a separate database modelA has Candidates and Mylearning2 has another one database and tables which ABP provide. I want to Access this Mylearning2 database tables on my ModelA model
Hi,
You can set the connection string. See: https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations#change-the-connection-strings-section
Hey, Thanks for replying.
I have gone through this documentation but in this documentation, they are configuring multiple databases in one module. But I have two modules and I Need the data of the Base module for My other Module I have MY multiple Connection String and dBContext. But I am not able to the list of user whose Role Is Teacher in my Sub Module......
<br> And as we Can See if I am Adding the Date Of Birth in Configure Extra property It's Showing DD-MM-YY-HH-MM-AM I need only DD-MM-YYYY can anyone suggest how to configure that....
they are configuring multiple databases in one module
The database is separated, and each module can have its own database, by configuring the connection string, a module can access the b database
See: https://docs.abp.io/en/abp/latest/Connection-Strings
Or you can use the C# API client proxies, This way you can access the API, but not directly read the database in the module
And as we Can See if I am Adding the Date Of Birth in Configure Extra property It's Showing DD-MM-YY-HH-MM-AM I need only DD-MM-YYYY can anyone suggest how to configure that....
You can add DisplayFormatAttribute to the extra property:
ObjectExtensionManager.Instance.Modules() .ConfigureIdentity(identity => { identity.ConfigureUser(user => { user.AddOrUpdateProperty<DateTime>( "Birthday", property => { var format = new DisplayFormatAttribute() { DataFormatString = "dd/MM/yyyy" }; property.Attributes.Add(format); } ); }); });
I tried that it's not working it's showing the same and I need a solution As we know when we create a project we will get the identity model in that we have a user, and role management this is in my main database and I have another model where I have the Candidate table which is in another database. in roles, I have a practitioner and I want to assign Practitioner to the Candidates please help me with this I followed that document but it's not working
Hi,
As far as I know, it's not possible to create a navigation property in a different database.
You should create relationships through code logic.
How to do that, can you guide us
@liangshiwei thanks for Your Valuable Replay Actually, four tables in one database I want to create the one is to one relationship between their tables each table is interconnected to each other if I delete one record of one table It should delete the respected records of another table i i want to generate the crud page for all this table
and regarding that Data time
OneTimeRunner.Run(() =>
{
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<DateTime>("DateOfBirth",
property =>
{
var format = new DisplayFormatAttribute()
{
DataFormatString = "dd/MM/yyyy"
};
property.Attributes.Add(format);
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.DisplayName = new FixedLocalizableString("Date Of Birth");
property.DefaultValueFactory = () => DateTime.Now;
//...other configurations for this property
}
);
});
});
});
}
i Have added this code again its showing same
Can you provide solution for this please Actually, four tables in one database I want to create the one is to one relationship between their tables each table is interconnected to each other if I delete one record of one table It should delete the respected records of another table i i want to generate the crud page for all this table
@liangshiwei Thanks For your replay Can you provide a solution for this, please? Actually, 1 four tables in one database I want to create the one is to one relationship between their tables each table is interconnected to each other if I delete one record of one table It should delete the respected records of another table I want to generate the crud page for all this table. want each and every table to connect one on one with the Table of Candidates. this is the main table I want all the tables to connect one on one to the Candidates' table. In the ABP suite, there is the only option of 1-N and N-N but how can I do 1-1 please help me with this... Thanks
Hi,
See: https://docs.abp.io/en/commercial/latest/abp-suite/generating-crud-page#navigation-properties
ABP Suite allows you to create a navigation property for 1-to-many (1:N) and many-to-many (N:N) relationships.
You can't do it with the ABP suite, but it's easy to do yourself:
public class MyEntity1 : AggregateRoot<Guid> { public MyEntity1(Guid id) { Id = id; } public string Name { get; set; } public Guid MyEntity2Id { get; set; } public virtual MyEntity2 MyEntity2 { get; set; } } public class MyEntity2 : AggregateRoot<Guid> { public MyEntity2(Guid id) { Id = id; } public string Name { get; set; } public Guid MyEntity1Id { get; set; } public virtual MyEntity1 MyEntity1 { get; set; } }
public DbSet<MyEntity1> MyEntityTest { get; set; } public DbSet<MyEntity2> MyEntityTest2 { get; set; } builder.Entity<MyEntity1>(b => { b.HasOne(x => x.MyEntity2) .WithOne(x => x.MyEntity1) .HasForeignKey<MyEntity2>(x => x.MyEntity1Id) .OnDelete(DeleteBehavior.Cascade); });
public class TestAppService : QaAppService { private readonly IRepository<MyEntity1> _myEntity1Repository; public TestAppService(IRepository<MyEntity1> myEntity1Repository) { _myEntity1Repository = myEntity1Repository; } public async Task CreateAsync() { var entity1Id = GuidGenerator.Create(); var entity2Id = GuidGenerator.Create(); var entity = new MyEntity1(entity1Id) { Name = "test", MyEntity2Id = entity2Id, MyEntity2 = new MyEntity2(entity2Id) { MyEntity1Id = entity1Id, Name = "test2" } }; await _myEntity1Repository.InsertAsync(entity); } public async Task DeleteAsync() { var entity = await (await _myEntity1Repository.GetQueryableAsync()).Include(x=>x.MyEntity2).FirstOrDefaultAsync(); await _myEntity1Repository.DeleteAsync(entity); } }
Deleting a Myentity1 will also delete the Myentity2, but, of course, not the other way around
Note: Only deleting the principal entity will cascade delete the dependent entity. Vice-versa is not possible.
If you want to delete any entity, the records of other tables will be deleted. You need to delete them manually.
@liangshiwei thanks for your replay
Actually, when I am running my application I am getting this exception please help me with This
The code is running fine with my other team but when I am trying to run the application i am getting this error
Hi,
You can check it: https://support.abp.io/QA/Questions/4483/After-login-It-is-not-redirecting-to-swagger-page#answer-0dac1928-15ab-ea7a-ad93-3a093a97493f
but I am running this application in local system my laptop