Base solution for your next web application

Activities of "sunilkosuri"

Ok, thank you. So, can we expose our Application Service methods using a regular Web API Controller? Thank you for any information.

Hello,

We are trying to create a Web API Controller Layer using the Application Services Layer. We are using .Net Core 2.2 for this.

We created a Class Library project using the .Net Core 2.2 , but it is complaining about references

public class MyTestController : AbpApiController { // code goes here
}

Error: CS0012 The type 'ApiController' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

When trying to add a reference to above DLL, But, it gives an error as attached below

Appreciate any help to resolve this issue.

Vishnu

Need your help! From Visual Studio 2017->Tools->AspNetZero->Create An Entity. We tried to create a table with foreignkey using the third tab (Navigation Properties). And clicked on Generate. In the command window, it displayed the files generated. But got error message "Build Failed". while adding migrations. Appreciate any help to resolve this issue. Thanks

So, it’s not enough to to do the following?

Configuration.EntityHistory.IsEnabled = true;

I specified the above in th code I posted.

I did configure it in my module. Please see the code I posted. However, it did not work.

Question

Hello,

I have configured entity history tracking in my module (where I created my own entities):

public class EPASSCoreModule : AbpModule { public override void PreInitialize() { //workaround for issue: <a class="postlink" href="https://github.com/aspnet/EntityFrameworkCore/issues/9825">https://github.com/aspnet/EntityFramewo ... ssues/9825</a> //related github issue: <a class="postlink" href="https://github.com/aspnet/EntityFrameworkCore/issues/10407">https://github.com/aspnet/EntityFramewo ... sues/10407</a> AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue9825", true); Configuration.EntityHistory.IsEnabled = true; Configuration.Auditing.IsEnabledForAnonymousUsers = true; ../ }

I then changed a property of an entity through the ReST service and it successfully changed it in the database. However, I don't see any database entries in any of the following 3 tables:

[dbo].[AbpEntityChanges] [dbo].[AbpEntityChangeSets] [dbo].[AbpEntityPropertyChanges]

As an example, my entities are configured as follows:

namespace RightHire.EPASS.Model { [Table("Buildings")] public class Building : FullAuditedEntity {

    [Column("Building_Id")]
    public override int Id { get; set; }

	public virtual string Building_Name { get; set; }
	
	public virtual string Building_Number { get; set; }

    [ForeignKey("Location_City_State")]
    public virtual int? Location_City_State_Id { get; set; }
    public virtual Location_City_State Location_City_State { get; set; } // Add this navigation property

    public virtual bool Active_Indicator { get; set; }
	
	public virtual string Facility_Number { get; set; }
	
	public virtual string Facility_Name { get; set; }
	
	public virtual bool Display_Global { get; set; }
	

}

}

What am I missing?

Hi,

I am using ASPNETZERO with EF Core + Angular template.

I have successfully created a database using Code-first approach. My database tables have primary keys that are different from "Id" and I successfully overrode "Id" as follows:

[Column("Country_Code_Id")] public override int Id { get; set; }

Additionally, Country_Code_Id has been configured as an identity column with auto-increment.

In the Administration UI, when I try to create a new Country Code, the UI shows an input for Country_Code_Id. I don't want to display this field because I want the system to auto-generate the value when I create the Country Code entry.

What changes do I need to make to make this work?

Thank you for any help.

Great! Thank you. That works.

Question

Hello,

I am using ASPNETZERO EF Core + Angular template.

I am using annotations in entities for foreign keys, but the migration is not adding any foreign key constraints. For example,

[Table("Personnels")] public class Personnel : FullAuditedEntity { [Column("Personnel_Id")] public override int Id { get; set; }

	public virtual int? Personnel_Type_Id { get; set; }
	
	public virtual string Last_Name { get; set; }
	
	public virtual string First_Name { get; set; }
	
	public virtual string Middle_Initial { get; set; }
	
	public virtual string Title { get; set; }
	
	public virtual DateTime? Birth_Date { get; set; }
	
	public virtual string City_Of_Birth { get; set; }

            [ForeignKey("Citizenship_Code")]
            public virtual int Citizenship_Code_Id { get; set; }		
}

How can I successfully add foreign key constraints to the migration (and hence the database)?

Also, is it sufficient to add the annotation only to the entity or is it necessary to add it to every place where there is a reference to this Citizenship_Code_Id in Input/Output and DTOs?

Thanks, Sunil

Showing 1 to 9 of 9 entries