Re: Extending SQL LINQ Table Class



Steven,

Thanks for the quick reply. You're right, extended properties work fine so long as you don't try to use them in a query.

I think I saw some references on the web to replacing properties that don't map to database fields to method calls which can be used
in queries.

BTW, the second link you gave me doesn't work.

- Mark

On Mon, 07 Jan 2008 09:11:13 GMT, stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT]) wrote:

Hi Mark,

I think custom properites with partial class for LINQ object class is
supported. As for the property you added, did you by any chance used it in
any data query expression? It seems the custom property will not be
recognized in any query expression to the datasource. Or you just get the
compile error without using the property in any place? here is a web forum
thread mentioned something about add custom property:

#Custom properties in LINQ to SQL classes
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1656614&SiteID=1

and here is a blog article about extending LINQ to SQL query:

#LINQ to SQL (Part 8 - Executing Custom SQL Expressions)
http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executi
ng-custom-sql-expressions.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: Mark Olbert <ChairmanMAO@xxxxxxxxxxxxxxxxx>
Newsgroups: microsoft.public.dotnet.framework
Subject: Extending SQL LINQ Table Class
Date: Sun, 06 Jan 2008 17:37:00 -0800


I am trying to extend a table entity class (generated from the visual
designer for data contexts) with a property that has no
corresponding column in the underlying Sql Server table.

When I do this, I get a NotSupportedException complaining that the
property I added has no supported translation to the database.

The documentation implies that properties not marked with the Column
attribute will be ignored when interfacing to the
database...but that's not what appears to be happening.

Is there some other attribute I need to decorate the property with to have
the property "skipped"? Or is it just not possible to add
properties to table entity classes using partial classes? If that's the
case, the documentation should make that clear.

- Mark

.



Relevant Pages

  • RE: Sorting a Gridview Control / Linq Result Set from SPROC
    ... It seems like we're doing a query and then burning time looping through the ... Based on my understanding you're using Linq to Sql and retrieve data via ... Microsoft Online Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: LINQ to SQL: OnLoaded() not firing
    ... OnLoaded is one of the extension methods of the LINQ to SQL entity classes, ... The OnCreated method is called when the entity class is created. ... When we generate a LINQ to SQL data query, for performance reasons, the ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Full Text Indexing Performance?
    ... Thank you for using Microsoft MSDN Managed Newsgroup. ... Server you can specify a list of columns in the CONTAINS query. ... Microsoft Online Community Support ...
    (microsoft.public.sqlserver.setup)
  • Re: ADSI script implement in C#
    ... I'm not quite sure about a pure LDAP syntax query since AD is not my ... Microsoft MSDN Online Support Lead ... I'm not quite good at ADSI, however, based on my research, the problem ... DirectoryEntry de = new DirectoryEntry; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: MISSING ACCESS RECORDS
    ... Thanks for using Microsoft Newsgroup Support Service, ... There are 40,000 rows in the query. ... 4.If you can provide the reproducible Access database and sent it to me, ...
    (microsoft.public.dotnet.framework.adonet)