Entity Framework – Model – Approach – Code First – Database – New Database

Background Continuing down the path of understanding how Entity Framework - Code First approach works with our SQL Server. Queries Submitted by Entity Framework to Database Connection Request Connection Request - Failed Exception Column :- TextData Database 'dbFriend' does not exist. Make sure that the name is entered correctly. Audit Log Failed Column :- TextData … Continue reading Entity Framework – Model – Approach – Code First – Database – New Database

Entity Framework – Model – Approach – Code First – Day 01

Background Without much in terms of conversation wanted to share the simplest files needed to put together an Entity Framework - Code First sample project.   Files Outline Source Code POCO Files friend.cs DBContextFiles dbContextFriend.cs Other Files app.cs Configuration Files app.config   In Depth Source Code POCO Files Friend.cs Class friend Property id name Annotation … Continue reading Entity Framework – Model – Approach – Code First – Day 01

.Net – Entity Framework – Error – “Error CS1070: The type name ‘TableAttribute’ could not be found. This type has been forwarded to assembly ‘System.ComponentModel.DataAnnotations’

Background A quick follow up to our last post on adding annotations to our plain old C# class ( POCO). Lineage .Net – Entity Framework – error CS0246: The type or namespace name ‘DatabaseGenerated’ could not be found Link   Error Error Text Error Image Remediation Outline Please be sure to add System.ComponentModel.DataAnnotations.dll to the … Continue reading .Net – Entity Framework – Error – “Error CS1070: The type name ‘TableAttribute’ could not be found. This type has been forwarded to assembly ‘System.ComponentModel.DataAnnotations’

.Net – Entity Framework – error CS0246: The type or namespace name ‘DatabaseGenerated’ could not be found

Background Here is our first post on adding annotations to our plain old C# class ( POCO). Lineage .Net – Entity Framework – error CS0246: The type or namespace name ‘DatabaseGenerated’ could not be found Link Error Error Text Error Image TroubleShooting Source Code Source Code - Included Namespaces Here are the originally included namespaces :- … Continue reading .Net – Entity Framework – error CS0246: The type or namespace name ‘DatabaseGenerated’ could not be found

.Net – LINQ – Exception – “Sequence contains no elements”

Background Playing around a bit with LINQ / Entity Framework and running into exceptions. Unfortunately the code itself is Vendor Supplied and reasonable big and so I am having to set up little test code snippets to have a playground. With a playground we can try to see if we will be able to set … Continue reading .Net – LINQ – Exception – “Sequence contains no elements”

Entity Framework – Change Database Column – Error – “could not be set to a ‘System.Boolean’ value. You must set this property to a non-null value of type ‘System.String'”

  Background Upon changing one of our database columns from varchar to bit, we experienced an invalid "System.InvalidOperationException" issue.   Error Error - "Unhandled Exception: System.InvalidOperationException: The 'status' property on 'usp_TraceFlagSourceFetch_Result1' could not be set to a 'System.Boolean' value. You must set this property to a non-null value of type 'System.String'" Here is the error … Continue reading Entity Framework – Change Database Column – Error – “could not be set to a ‘System.Boolean’ value. You must set this property to a non-null value of type ‘System.String'”