This is my scenario for tables Users can transfer money to each others. There are two options when the transferring. One is the direct to users budget, other one is project budget for the user to spend. a user can have multiple bank accounts. So, I would like to see list for transfer table according to recipter account Id. This
Tag: entity-framework
A problem with the foreign key using Entity-Framework
Im using Entity Framework and have this two classes: And I instance a new Product like this: When I add and save this object, does not record it in the database, but if I instance the product with a NULL value in the Client attribute, does appear but with that NULL value. I dont know why this is happening… Answer
Converting complex SQL with FULL JOIN to Linq
I am trying to convert a SQL statement to Linq/Entity Framework, and am having a difficult time. Below is the SQL. The FULL JOIN and the GROUP BY seem to be what I’m struggling most with. I’ve reviewed this SO answer and I understand how to execute a FULL JOIN on its own, but can’t figure out how to integrate
Seeding a table with Foreign key
I encountered a problem where I cant seed an SQL script since it has a foreign key constraint, I tried context.SaveChanges() but it isn’t working. Is there any way how this can be done? protected …
How to make lookup field work in this case without defining the foreign key in the database?
The code is as follows (database first): C# code: UserTypeId is mapped, UserType is not. Any ideas how to make it work? Answer If we consider this as one to many relationship. Then Mapping using dataanotation will be like this. And to query
Entity Framework – Left outer join on multiple columns with OR condition
Is it possible to write lambda left join on multiple columns that would generate OR condition instead of AND? This will generate following query I would like to get the same query but instead of AND condition I want it to be OR: Is there a way to achieve this? EDIT: version – EF 6.2.0 Answer LINQ join operators (Join,
How to replace columns in a Queryable in a generic fashion without executing the Queryable
As an example, I have a Product entity, a ProductViewModel and a Label entity. Two of my product properties correspond to a label code rather than an actual value. So for example a Product’s Name is “…
How can I convert this sql query that reorders items in a database to linq?
I currently have a table where an item has a new order based on a column it’s being sorted by. The goal of the sql statement is to reorder the table based on that sort column. The SQL Command …
LinqToSql OrderBy has no Effect
I am using a LinqToSql-DataSource for a GridView in this way: Now i want to order the Selection. At first the “stammVerein”-Column of Table “mitgliedschaft” descending AND the Column “eintritt” of Table “mitgliedschaft”. I have tried several ways: AND: AND: But nothing of this has any Effects ! I am very new in this kind of DataSource and Linq. Can
I have multiple entry and exit status of a person. how do i get the last status of single person
I have a table in sql in following format Output required Answer In_Time should be the first instead of the last status. Then your result should be instead Userid IN_TIME OUT_TIME Code like below, live demo here Updated If you want to get the last status for In_Time, just adjust slightly condition from Min to Max like below, live demo