-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update One Column in Entity issue #3621
Comments
Hi @atak946 |
So when is the nameSpace.update function used? I did not understand the meaning of this function when update relational table, this function setted null all relationed id columns but i sent it all columns with filled relation id. Add Columns to example table:
My Data Before Request:
Example Request Data:
Result of data:
|
You should check the code of your application service update method. |
@liangshiw @maliming are you have any idea? |
I don’t think ABP needs to change.I tested your use case and it has no problems. Entities: public class Qa : Entity<int>
{
public string Name { get; set; }
public int? QaItemId { get; set; }
public QaItem QaItem { get; set; }
}
public class QaItem: Entity<int>
{
public string Name { get; set; }
} Application Services: public class TestAppService : CrudAppService<Qa,QaDto, int, PagedAndSortedResultRequestDto, QaDto, QaDto>, ITestAppService
{
public TestAppService(IRepository<Qa, int> repository) : base(repository)
{
}
} And test result: |
@liangshiw |
Please use the CLI to reproduce, and then give me the repository |
@liangshiw i'll upload tonight, As I tested with jquery ajax, only 1 column is going to be null, as most of the problem is solved. When I try with different browsers, only 1 property in the mozilla goes null and there is a problem like chrome in the opera. I have to identify the problem of the remaining 1 property being null.
|
Can you give me the repository? |
https://github.com/atak946/xrepo if the column is full it empties, if it is empty it fills. it does this only in relational columns |
@atak946 I mean you use CLI to create a simple project to reproduce the issue. |
Hi @atak946, With that example, you are using the Also in your code you did not implement the Also I could not run your repository, So basically it is not related to ABP. The |
No, updaterow is only different test method not main method. i already have this error. You will remove updaterow. it's not have any dependency im busy now, i m have this error in clean project created by cli and not have custom crudappservice. i'll upload wait for it. And this error fired after version update 2.0 to 2.5 |
İngilizcem yetmiyor artık Ahmet bey o updaterow metodunu da denemek için ekledim bu testi yapmamı da liang bey söyledi yukarıda okuyabilirsiniz. sorunla uzaktan yakından ilgisi yok bu sorun 2.0 versiyonundan 2.5 versiyonuna yükseltme yaptıktan sonra çıktı. CustomCrudAppService ile de ilgisi yok onu kaldırınca da sorun devam ediyor. Müsait olamadim müsait olunca cli ile oluşturulmuş boş projeyi de yükleyeceğim bu konuyu anlamadan kapatmanız da yanlış olmuş. Ek olarak bu Proje de aktif çalışan bir proje yani önceden beri olan bir hata değil. Updaterow metodunu da bu sorun çıktıktan sonra denemek için ekledim. Benim asıl sorunum update fonksiyonunun relation id kolonlarını boş ise doldurması dolu ise boşaltması gönderdiğiniz değerin hiç bir önemi olmadan bunu yapıyor . Umarım anlatabilmişimdir. |
@atak946 So I reopened it to inspect more. Please mention me when you create the test project with cli. |
Hi @atak946, I've created an example application to explain detailed.
You specified your problem here, you want to update one property of an entity, but when you use I'll give you solution step by step. I've created app and I have an entity that named As you said, when I send some data to update it will removes others because there is no good mapping in my project yet. It is occurs because the So let's change some settings. I just added that code to the AutoMapper settings. It will ignores the null variables. So the result is. It looks like the problem is fixed! BUT IMPORTANT!It is occurs a problem, "What will happen when you want to update a property to You should look at the As I said before, it is not related to the ABP Framework. |
Hi, @cotur Thanks to @liangshiw I understood the map problem you mentioned and I tried to send all the properties.
but this time I came across another problem, I tried to convey and share visuals but I guess it is a problem I cannot explain. this is not a normal problem, why should it succeed when it first executes the same request and fails when it triggers again later. It's hard to explain. My problem is that although I send this field full, it will be saved as empty. Please read this comment. after readed the comment, please look at the gif image (bottom of the next comment) Thank you for your interest. |
I tried this issue at repository that shared with us by you. The problem is The When you call As a result, we should follow |
Hi everyone,
i'm using
nameSpace.table.update
method but i have problem.im updating one column but all column's updating to null,
Example Table Columns:
Example Data:
After Update Data Result
why update function set NULL to all columns?
I just want to update one column, how can I do this?
Best Regards
The text was updated successfully, but these errors were encountered: