I had read your reply a while back, but - thank you - the advice is appreciated. We are not so experienced with ASPNetZero, but this seems like a good approach that we will keep in mind.
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?
Thanks! That works for a migration, and will make the replication easier. I think I also need to add the the "DatabaseGeneratedOption.None" property, though, like so:
[Column("OID"), DatabaseGenerated(DatabaseGeneratedOption.None)]
public override int Id { get; set; }
... as the OID coming from the legacy system will need to be used by the replication code, rather than having an auto-generated value. Then I just need to set the OID explicitly when we start creating data within the ASPNetZero solution.
Thanks for your help! :)
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).
@tadams - many thanks, this solved the same issue I was having just now.
Ok, I just managed to solve this myself with more experimentation. The steps that occurred between this error happening and eventual success included 1) uninstalling and then reinstalling node.js, 2) uninstalling the "HP Wolf Security" that was present on my laptop - this had it's features all disabled but perhaps it still being present and scanning files was the issue and 3) rebooting. So perhaps this information might help someone else too.
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?