Questions tagged [componentmodel]
21 questions
25
votes
2 answers
What is the difference between IEditableObject and IRevertibleChangeTracking?
What is the difference between IEditableObject and IRevertibleChangeTracking (both from the System.ComponentModel namespace)? It looks as if the first supports explicit transaction whilst the second is more implicit - but the net result is the…

open-collar
- 1,404
- 1
- 16
- 22
10
votes
2 answers
.NET Component Model explanation
First of all, I have to say that I'm going to talk about System.ComponentModel.Component.
You know, I understand, that the .NET Component Model provides ability (through Site Services) to define separate Components, so they can communicate with each…

theSpyCry
- 12,073
- 28
- 96
- 152
8
votes
2 answers
How to disable designer in derived classes in following generations
In order to disable component designer in classes it is simple to add just [System.ComponentModel.DesignerCategory("")] attribute to it, however it does not work for any classes derived from this class in any generation.…

Tamir
- 2,503
- 16
- 23
8
votes
2 answers
Removing Required Attribute from Class but MVC3 still won't post the form without a value in the text box
I have a class. At one point, I had set the properties of the class to [Required] using System.ComponentModel....
Okay, then I realized this was not needed. I have removed the required property but when I try to submit the form to an…

Robert Green MBA
- 1,834
- 1
- 22
- 45
5
votes
1 answer
ASP.NET MVC3: ValidationType ModelClientValidationRule
I just created a sample MVC3 application to learn validation. It is using DataAnnotations. I have created a custom ValidationAttribute named CustomStartLetterMatch. It is implementing “System.Web.Mvc.IClientValidatable”. I have corresponding…

LCJ
- 22,196
- 67
- 260
- 418
4
votes
2 answers
Is it possible to hide properties of a class by default, e.g. in a DataGridView?
I'm well aware of the attribute that I can apply to every property of a class. Is it possible to set the default value of the Browsable attribute for all properties to False?
The following code compiles and…

mike
- 1,627
- 1
- 14
- 37
4
votes
4 answers
C# show browsable child properties in designer
I'm using .NET C# with standard WinForms, not WPF.
I have this situation.
I'm creating a user control for a month calendar, similar to the .NET one but with a little more functionality.
I have a user control form, that fills with button objects…

Zoran Ivancevic
- 91
- 1
- 1
- 5
3
votes
1 answer
Custom Validation using ValidationAttribute does not fire Client side validation
I have created a custom validator deriving from ValidationAttribute. My undertsandng is that it will generate enough meta data for the client side script to automatically validate (using jquery.validate). The custom validator is working fine in…

LCJ
- 22,196
- 67
- 260
- 418
3
votes
4 answers
Programmatically Hide Property in PropertyGrid
Using
_
on the declaration of a class (which is a property of another class) that consists of a number properties.
I load an instance of this class with…

hmcclungiii
- 1,765
- 2
- 16
- 27
3
votes
1 answer
Get c# attribute applied to this instance?
Is it possible to retrieve the value of an attribute applied to an instance of a class from within that class? An example of this would be:
class Host {
[XmlElement("NAME")]
public ChildClass c { get; set; }
}
[Serializable()]
class…

CoryG
- 2,429
- 3
- 25
- 60
3
votes
1 answer
How do I use the service locator implementation in System.ComponentModel for dependency injection in a WinForms application?
I'm trying to allow my business logic components to query for services when they are added to one of my form/control classes. For example, I might have a ClientManager class in my library, which encapsulates some business logic. It requires an…

Alex J
- 9,905
- 6
- 36
- 46
2
votes
3 answers
How to programatically turn on/off a Data Annotation Validation Attribute
So, I am using ASP.NET MVC 3 and Entity Framework 4.1 (code-first).
I have a class like this:
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
[Range(18, 99)]
public int Age { get; set; }
}
The…

iuristona
- 927
- 13
- 30
2
votes
2 answers
Serialize ComponentModel.Container?
Is it possible to serialize (binary) a System.ComponentModel.Container?

IAbstract
- 19,551
- 15
- 98
- 146
1
vote
1 answer
Can I use other attribute arguments than numbers in DataAnnotations.StringLength?
I have a (Settings) class that contains all hardcoded code. It's really handy for certain fields such as maxCharactersFields and error messages, this way I can use the same field for mapping, models & viewmodels. Therefore if it were to change it…

Ruben Szekér
- 1,065
- 1
- 10
- 21
1
vote
1 answer
Trying to install NuGet package programmatically - Package.GetGlobalService returns null
I'm trying to get the list of installed NuGet packages in my ASP.NET MVC application and I'm using NuGet.VisualStudio like this:
var componentModel = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel));
IVsPackageInstallerServices…

Mo Sadeghipour
- 489
- 8
- 25