I am using LINQ to SQL and lets say I have a table called Files. And in that table, there is a FileID. I was to give the FileID the attribute of [ScaffoldColumn(false)].
But, my question is, how do I give the FileID that attribute without modifying the linq to sql class file?
I dont want to have to add that attribute everytime i regenerate or make changes to my tables.
ASP.NETC#Microsoft SQL Server
Last Comment
kaufmed
8/22/2022 - Mon
kaufmed
Partial classes, my friend... partial classes:
public partial class YouLinq2SqlClass{ // Auto generated code}[ScaffoldColumn(false)]public partial class YouLinq2SqlClass{}
public partial class YouLinq2SqlClass{ // Auto generated code... public int FieldId { get;set; }}public partial class YouLinq2SqlClass{ [ScaffoldColumn(false)] public int FieldId { get;set; }}
Where exactly do I put the partial class? Do I create a seperate clas file?
Also did you mean:
[ScaffoldColumn(false)]
public int FileID
}
}
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
michael1174
ASKER
When I'm on my dbml file, i press F7, it creates a seperate class file:
namespace AMC
{
partial class AMCDataContext
{
}
}
but then when i try to recompile, get a lot of errors....
so i'm just unsure how where to put the partial class....
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Open in new window