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

Activities of "Kaarlaid"

Prerequisites

  • What is your product version? 11.2
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET CORE

I have a requirement to connect, within ASPNetZero, to another database at the same time to provide API access to legacy data (in this case I am using Developer Express's XPO), but still with access determined by ASPNetZero rules. However, I cannot work out within which of the layers of the ASPNetZero architecture I should be doing this. I am wondering if you have a 'best practice' recommendation for this case (which could well be the same as connecting to two database at the same time utilising EF)? And also at which level the APIs should be implemented?

We are developing an ASPNetZero solution to augment an existing desktop + MS Sql Server solution, and are going through the process of using the RAD Tool to build table structure that match, as closely as possible, the existing desktop solution. After this is done we will use a replication process to transfer records between the desktop (local) and ASPNetZero (remote) databases.

The problem we have is that the desktop solution has been developed using Developer Expresses XPO (as an ORM), and it creates the primary key with field name OID, eg:

For the replication process to be as simple as possible to implement I'm - based on information from another ticket - trying to create the following structure for our ASPNetZero solution:

 [Table("City")]
    public class City : Entity, IMayHaveTenant
    {
        [NotMapped]
        public override int Id
        {
            get { return OID; }
            set { /* nothing */ }
        }

        public int? TenantId { get; set; }

        [Required, Key]
        public virtual int OID { get; set; }

        public virtual int? CreatingUser { get; set; }

        public virtual int? LastEditedUser { get; set; }

        public virtual int? Country { get; set; }

        [StringLength(CityConsts.MaxNameLength, MinimumLength = CityConsts.MinNameLength)]
        public virtual string Name { get; set; }

        public virtual int? OptimisticLockField { get; set; }

        public virtual int? GCRecord { get; set; }

    }

Firstly - does this seem a correct approach to you? New "City" records, eventually, need to be created within the ASPNetZero solution (and replicated to the ''local" database), as well as continuing to be created within the "local" database (and replicated to the remote / ASPNetZero solution).

Nextly - when I try and apply a migration based on the above structure I get this error message: "To change the IDENTITY property of a column, the column needs to be dropped and recreated." ... which I guess is related to the "OID" column.

I was wondering if you had any experience or advice to offer with this scenario. I guess another solution is to just override the ID field, and make it non-autogenerated, then use our replication code to handle the difference in table structures (with OID on the local database side, and ID on the remote ASPNetZero side).

This is for a new ASP.NET Core / Jquery solution (v11) and trying to follow: https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Getting-Started-Core

My PC is on Windows 11, and each time the error occurs on a different file:

I have tried all the solutions available via Google (clean cache, restart Windows, reinstall NPM, add exception for Windows Defender for the path etc etc). I also tried using "Lockdown hunter", but it finds nothing except CMD.exe for the path, and it's impossible to otherwise check as the file with the problem changes each time.

Do you have any suggestions, please?

Showing 1 to 3 of 3 entries