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

  • Home
  • SEARCH
  • 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 7589401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:08:59+00:00 2026-05-30T20:08:59+00:00

Given a table or view with an Integer column is it possible to do

  • 0

Given a table or view with an Integer column is it possible to do a conversion or cast to a String value in the DBML or create a calculated property on the entity that can be used as a relationship to another entity?

enter image description here

I have tried making the generated type a string but it gives an error:
Error 1 DBML1005: Mapping between DbType ‘Int’ and Type ‘System.String’ in Column ‘Foo’ of Type ‘FooRecord’ is not supported. 0 0

  • 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-05-30T20:09:00+00:00Added an answer on May 30, 2026 at 8:09 pm

    I don’t think you can do anything like this – not in the Linq-to-SQL data model, for sure. If it’s an INT in the database, it’s an INT in the model and cannot be “manipulated” into being a string all of a sudden…

    But what you could do is extend that class that Linq-to-SQL generates for you – it’s a partial class, e.g. you can extend it in a separate, second file:

    YourEntityEx.cs

    public partial class YourEntity
    {
       public string YourPropertyAsString
       {
          get { return YourProperty.ToString(); }
          set { YourProperty = Convert.ToInt32(value); }  // if you even this
       }
    }
    

    This way, you now have a second property YourPropertyAsString on your YourEntity class that will always be exactly the same as YourProperty – only of type string.

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

Sidebar

Related Questions

Given a table of id, 'points' and coordinates, would like to create a view
Given an ASP.NET MVC view that generates a table of entries using a for
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT
Given a table such as: CREATE TABLE dbo.MyTestData (testdata varchar(50) NOT NULL) ALTER TABLE
Given a table where the first column is seconds past a certain reference point
Hi does any one know how to check if a given DB object (Table/View/SP/Function)
So given: CREATE TABLE stuff ( really_long_title int(10) NO NULL auto_increment, really_long_title_number_1 varchar(10) NO
For a given table 'foo', I need a query to generate a set of
I am trying to link two fields of a given table to the same
Given a table (mytable) containing a numeric field (mynum), how would one go about

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.