What are Vanilla objects in .NET?

I read this article from MSDN on dependency entry , and I saw a term in an article that I did not quite understand to quote:

There are several reasons to use containers in application development. Containers provide the ability to wrap vanilla objects with a host of other services. This allows objects to remain unaware of certain infrastructures and plumbing details, such as transactional and role-based security. Often client code does not need to know about the container, so there is no real dependency on the container itself.

These services can be declaratively configured, that is, they can be configured using some external means, including graphical interfaces, XML files, property files, or vanilla .NET attributes .

I understand that 'vanilla' usually refers to something equal, but I don't quite understand the point here.

What is vanilla in .NET?

+4
source share
2 answers

In a certain context, the question will become much clearer, but it is usually used to refer to an ordinary object (or type) without "special authority". For example, if the serialization scheme claims to work with "vanilla objects", you will not need to decorate it with additional attributes, etc., to serialize it. Similarly, if ORM works with vanilla types, it will not need to implement a specific interface or something like that.

EDIT: Well, seeing the context, the above seems to be correct.

Another way to think about it is that you can write a type that can then be used by the framework without knowing the type of structure. Thus, some DI frameworks require you to decorate types yourself in order to allow injection, while others do not. Recent structures can work with vanilla types.

+10
source

I don’t really know ... but in terms of meaning I would suggest that it could be an instance of a class that has only a constructor, and where you can read / write members without any other methods. Often this class is useful, so it may be that someone found a name for it. For example (in C ++) consider

struct P2d { double x, y; P2d(double x, double y) : x(x), y(y) {} }; 
+1
source

All Articles