Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
91 views
in Technique[技术] by (71.8m points)

c# - What is a context?

It seems to me that a Context class is a control console whose object can invoke any included functions, such as Datacontext and DomainContext in WCF Ria service. Do I understand this concept correctly? If so, in what circumstances do I need to create a context class in my own class hierarchy?

Beside DataContext, what other well-known Context classes does the .net framework have?

question from:https://stackoverflow.com/questions/12240420/what-is-a-context

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can think about the context as a wrapper for related "things" such as HttpContext, DbContext, ObjectContext. i.e.: HttpContext contains any information you can reach for HTTP related operations.

DbContext contains the methods and properties for database communication. Likewise ObjectContext.

I would say it's a placeholder or container of related things for something.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...