How do I add data from a table column in C # and SQL Server with Entity framework?

0

I'm working with c # in visual studio and entity framework, I'm a novice in this. What I need is to add a column of a sql server table. I had thought about creating a list with all those numbers and then adding them. But I do not know how to do this. If you could help me, I'd appreciate it!

    
asked by andeehr 09.12.2018 в 02:56
source

1 answer

1

It's simple you just have to use the linq extension method

Enumerable.Sum Method

something like the following

var result = dbcontext.NombeEntidad.Sum(x=> x.Propiedad);

in the lambda you indicate which is the property that you are going to add

    
answered by 09.12.2018 / 15:02
source