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?
Definition of context 1 : the parts of a discourse that surround a word or passage and can throw light on its meaning. 2 : the interrelated conditions in which something exists or occurs : environment, setting the historical context of the war.
An example of context is the words that surround the word "read" that help the reader determine the tense of the word. An example of context is the history surrounding the story of Shakespeare's King Henry IV. (linguistics) The text in which a word or passage appears and which helps ascertain its meaning.
The definition of context is the setting within which a work of writing is situated. Context provides meaning and clarity to the intended message. Context clues in a literary work create a relationship between the writer and reader, giving a deeper understanding of the intent and direction of the writing.
Context Definition It is the detail that adds meaning to a text. Readers can study internal context—details included by the author, such as backstory, characterization, or setting—as well as external context—the time period of the work's publication, the author's literary influences, and even their personal history.
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.
To me, a context object defines a set of values and/or functions that are bound to the current execution path. In other words, just like speaking about a technical topic in the context of a job interview is different than speaking about the same topic at a nerd dinner, the context changes based on factors that affect the runtime environment of the consuming code. That seems abstract, but I can't think of a better way to describe it at the moment!
Another famous context in .NET is the HttpContext
object. Which values will change based on what Http operation is being handled. For example, the url will change in HttpContext.Current.Request.Uri
. Hope that puts it in context for you :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With