I am using contrast security (third party tool that indicates SQL Injection, Vulnerabilities) and entity framework, my code is like this:
public int Insert(UserAddress userAddress)
{
    _context.Entry(userAddress).State = EntityState.Added;
    _context.SaveChanges();
    return userAddress.Id;
}
When SaveChanges() gets executed, an insert query is generated like this:
INSERT [dbo].[Address] ([UserId], [Name], [Address1], [Address2],
                        [City], [State], [PostalCode], 
                        [Location], [LocationTypeId],
                        [BusinessName], [DeliveryInstructions],
                        [IsDefault], [SortOrder])
VALUES ('111111a1-22z2-33x3-44y4-fbad42c09c3a', @2, 'address1', null,
        'Alpharetta', 'GA', 30005,
        'POINT (-80.2427068 30.0925161)', 0,
        '', '',
        1, 0)
Now, according to contrast security, passing "null" in query is not ethical, it's bad practice - but I want to allow null values!
Can I pass null values using SQL parameters to the SaveChanges() method?
Is there any way to handle this? Does anyone have any idea?
 
    