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'”

Entity Framework – Using Database Functions

Background We are going to add functionality to add records to our referenced table. The table that we will be adding data has a primary key consisting of two columns. The two columns are id and sequenceNbr. The id column binds us to the parent\referenced table. And, the sequenceNbr is a progressive column that we … Continue reading Entity Framework – Using Database Functions