[linq2db.Access] DC.update(object) doesn't update pointer to related tables
See original GitHub issuehello!
There’s no exception but during a simple update, the foreign key field is not updated. Here’s the code:
Dim myPrj As PrjMain
myPrj = DM.PrjMains.getByID(DC, myID).FirstOrDefault
myPrj.Title = tbxTitle.Text.Trim
myPrj.FkIDCompany = CType(ddlCustomer.SelectedValue, Integer) 'this one is not updated
myPrj.FkIDCompanyBroker = CType(ddlBroker.SelectedValue, Integer) 'this one is OK!!!!
myPrj.FkIDPrjType = CType(ddlProjectType.SelectedValue, Integer)
myPrj.FkUserNameConsultant = ddlConsulente.SelectedValue
DC.Update(myPrj)
Here is model extract:
[Table("PRJ-Main")]
public partial class PrjMain
{
[Column(), PrimaryKey, Identity] public int ID { get; set; } // Long
[Column("title"), Nullable ] public string Title { get; set; } // VarChar(255)
/// <summary>
/// Cliente
/// </summary>
[Column("FK_IDCompany"), Identity] public int FkIDCompany { get; set; } // Long
/// <summary>
/// Segnalatore
/// </summary>
[Column("FK_IDCompanyBroker"), Nullable ] public int? FkIDCompanyBroker { get; set; } // Long
/// <summary>
/// Importo da riconoscere al segnalatore
/// </summary>
[Column("amountFeeBroker"), Nullable ] public decimal? AmountFeeBroker { get; set; } // Currency
/// <summary>
/// Link a tabella dei tipi di progetto
/// </summary>
[Column("FK_IDPrjType"), Identity] public int FkIDPrjType { get; set; } // Long
/// <summary>
/// Consulente
/// </summary>
[Column("FK_UserNameConsultant"), NotNull ] public string FkUserNameConsultant { get; set; } // VarChar(50)
/// <summary>
/// Data inserimento a sistema
/// </summary>
FkIDCompany is not updated when FK_IDCompanyBroker is correctly done.
The difference is that FkIDCompany
is mandatory (type integer) instead of FK_IDCompanyBroker
(type nullable(of integer))
If I change FkIDCompany as not mandatory (nullable(of integer)) all work good!
is there a problem?
Thank you!
Environment details
linq2db version: 3.4.2
Database Server: MS Access
Database Provider:
Operating system: Windows 10
.NET Framework: 4.7.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:36 (18 by maintainers)
Top Results From Across the Web
Project on update/create (set values from another object en ...
What I am trying to achieve is basically expression-based two-way mapping between an entity class and a DTO, kinda like AutoMapper's projection ...
Read more >Unable to update or delete data in a linked table
Workaround. To work around this problem, import the text file to the Access database and then run the update query or run the...
Read more >W3layouts cms exploit
For example, you can write code to change the value of a pointer. write code ... desired Access to XMLHttpRequest on data tables...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep
two providers mode for access implemented in https://www.nuget.org/packages/linq2db.cli