Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:05:47+00:00 2026-06-09T19:05:47+00:00

I have an entity/table that uses sqlgeography. Since EF 4.X doesn’t support spatial types

  • 0

I have an entity/table that uses sqlgeography.

Since EF 4.X doesn’t support spatial types I’m instead sending the bytes of the field back and forth.

I have stored procs on the database side that handles the converstion and properties on the code side to do that job.

To add the properties in the code I used a partial class.

One of those properties is for the SqlGeography which simply wraps around the byte[] property to handle getting and setting.

This property is hidden from EF using the NotMappedAttribute.

The other is the property exposing the byte[] itself and is decorated with the EdmScalarPropertyAttribute and DataMemberAttribute.

I then go to the EF model designer (*.edmx) to point the entity model at the Insert/Update/Delete stored procs.

It finds the stored procs alright and realises that they (when appropriate) take a VARBINARY parameter.

It also has a drop down allowing you to select a property on the entity class which maps to that parameter.

However this drop down doesn’t list either of my properties. I don’t care about the SqlGeography property since that is meant to be hidden from EF, however it is vital for me to be able to point it at the byte[] property, as that is where the data comes from.

I would very much like to avoid database triggers or wrapper classes and addiitonal fields to fudge this in to working.

I tried manually editing the .edmx file to include the byte[] property, but then it just complains it’s unmapped.

Can anyone give me some insight in to how to get this to work? Or an alternative method of achiving the end result?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:05:48+00:00Added an answer on June 9, 2026 at 7:05 pm

    In the end we created a computed column for each table that exposes the spatial data as bytes.

    We then use stored procs for inserting and updating the spatial data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a DB table that is mapped into a hibernate entity. So far
I have an Entity Framework generated table with values in a td that I
I have a LINQ to ENTITY query that pulls from a table, but I
I have a SQL Server 2008 database table that uses uniqueidentifier as a primary
I have an application that uses Entity Framework to access the data, and throughout
I have a DB table that uses the following schema: CREATE TABLE users (id
I have a WCF that uses a ADO.NET Entity Data Model to access SQL
I have a method that uses Entity Framework to do some changes/inserts in different
I have a large application that uses EJB 2.x entity beans (BMP). This is
I have two tables that are considered a single entity in my domain model.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.