score:0
Accepted answer
In your table mapping, is the field marked as 'Auto Generated Value' in the Properties pane? I've had insert/update issues with that before... – Tieson T. Mar 7 at 6:52
I would give him the props for this, but he left this as a comment, and not an official answer.
score:2
I have seen something like this before.
It happens when you only assign the 'id' and not the related object.
Try the following:
new FileType
{
FileCategory = def.Category,
...
}
Source: stackoverflow.com
Related Articles
- C# Why is Linq crashing about a Null if the value is not null?
- LINQ syntax where string value is not null or empty
- Return null instead default value in LINQ
- How to assign empty string if the value is null in linq query?
- LINQ - Returning value of a property of an object that is not null
- Linq GroupBy with each null value as a group
- Null value cannot be assigned - LINQ query question
- Linq GroupBy on multiple columns with potentials null value
- LINQ error: The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type
- LINQ Source Code Available
- How to use Contains() function if field value is null in linq
- Using DefaultIfEmpty in Linq - problem substituting a null value for a default value
- Linq query, how to check for a null value and use the value 0 in place of a null?
- The cast to value type 'Int32' failed null value LINQ
- Linq remove where if the value is null
- Linq check for null and replace null value in orderby
- SQL Trigger is trying to insert a null value but my C# code is passing int 300?
- Should GetHashCode() method take care about null value given as parameter?
- Check null value in a list using linq
- Linq query containing null value
- Foreign Key Reference Already Has Value Exception Linq to SQL When Assigning Null
- LINQ to Entities question about orderby and null collections
- creating Linq to sqlite dbml from DbLinq source code
- How to treat null value in Linq Select
- Linq set null to a value with automapper
- Why does this LINQ query assign a value of 1 to a NULL value from the database?
- C# - Code supposed to be unreachable when calculate value in LINQ sum method
- Linq - Getting second value only if != null
- How to check if Linq Expression value is null
- Checking for null value in c# var with LINQ & Entity framework
- run Task as I type with linq(cancel previous Task if still running)
- Selecting a new object without grouping in linq?
- How to tell "OfType()" to ignore inherited classes?
- How does Entity framework perform Transactions inside asp.net mvc
- Relax C# LINQ String Comparison (Trim, Case Insensitive, ??)
- C# string to number, TryParse returns true when Parse fails
- Linq select query, how to append results to object of a class
- Modifying Linq to remove repetitiveness
- Filtering a list by a property matching a property in another list
- Calculate Running Total in Linq
- How to check for results in query before performing aggregate operation?
- Implement pagination using LINQ (on the server side)
- What's the most (performance) efficient and readable way to 'split' a generic list based on a condition?
- calculate user stats with LINQ
- How to choose columns from a query and display in datagrid
- LINQ search in list with space separated values
- Inserting data 2 times in entity
- Linq Select by PK?
- How to sort a list on a column value
- How do you include all fields from first table in join, and some from remaining?