Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 18th, 2012  |  syntax: None  |  size: 5.96 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to add documentation tooltip to classes, methods, properties, etc. in C#?
  2. /// <summary>
  3. ///
  4. /// </summary>
  5. class A
  6. {
  7.     /// <summary>
  8.     ///
  9.     /// </summary>
  10.     public A() { }
  11.  
  12.     /// <summary>
  13.     ///
  14.     /// </summary>
  15.     public int Property { get; set; }
  16.  
  17.     /// <summary>
  18.     ///
  19.     /// </summary>
  20.     /// <param name="obj"></param>
  21.     public void Method(object obj) { }
  22. }
  23.        
  24. /// <summary>
  25. ///
  26. /// </summary>
  27. class B
  28. {
  29.  
  30.     /// <summary>
  31.     /// Initializes a new instance of the <see cref="B"/> class.
  32.     /// </summary>
  33.     public B() { }
  34.  
  35.     /// <summary>
  36.     /// Gets or sets the property.
  37.     /// </summary>
  38.     /// <value>
  39.     /// The property.
  40.     /// </value>
  41.     public int Property { get; set; }
  42.  
  43.     /// <summary>
  44.     /// Methods the specified obj.
  45.     /// </summary>
  46.     /// <param name="obj">The obj.</param>
  47.     public void Method(object obj) { }
  48. }
  49.        
  50. /// <summary>
  51. /// Defines the behavior of a class following the Repository pattern for data access
  52. /// with basic atomic operation control.
  53. /// </summary>
  54. /// <typeparam name="TRest">An interface derived from IDomainObject that describes domain objects
  55. /// that can be retrieved or saved by this Repository.</typeparam>
  56. public interface IRepository<TRest> : IDisposable where TRest : IDomainObject
  57. {
  58.     /// <summary>
  59.     /// Begins a new unit of work to be performed atomically by the Repository.
  60.     /// </summary>
  61.     /// <returns>A token class representing the unit of work.</returns>
  62.     IUnitOfWork BeginUnitOfWork();
  63.  
  64.     /// <summary>
  65.     /// Commits all work performed under the specified unit of work.
  66.     /// </summary>
  67.     /// <param name="unitOfWork">The unit of work.</param>
  68.     void CommitUnitOfWork(IUnitOfWork unitOfWork);
  69.  
  70.     /// <summary>
  71.     /// Rolls back the specified unit of work.
  72.     /// </summary>
  73.     /// <param name="unitOfWork">The unit of work.</param>
  74.     void RollBackUnitOfWork(IUnitOfWork unitOfWork);
  75.  
  76.     /// <summary>
  77.     /// Saves the specified domain object to the data source controlled by the repository.
  78.     /// </summary>
  79.     /// <typeparam name="T"></typeparam>
  80.     /// <param name="domainObject">The domain object.</param>
  81.     /// <param name="unitOfWork">The unit of work.</param>
  82.     void Save<T>(T domainObject, IUnitOfWork unitOfWork) where T : class, TRest;
  83.  
  84.     /// <summary>
  85.     /// Begins a Linq query for a specific object type, to be performed against the Repository's data source.
  86.     /// </summary>
  87.     /// <typeparam name="T"></typeparam>
  88.     /// <param name="unitOfWork">The unit of work.</param>
  89.     /// <returns>An IQueryable representing the query to be performed.</returns>
  90.     IQueryable<T> QueryFor<T>(IUnitOfWork unitOfWork) where T : class, TRest;
  91.  
  92.     /// <summary>
  93.     /// Performs the specified Action using a new unit of work, with commits and rollbacks as necessary.
  94.     /// </summary>
  95.     /// <typeparam name="T"></typeparam>
  96.     /// <param name="func">The Action to perform. The lambda or named method must accept an IUnitOfWork as a parameter.</param>
  97.     /// <param name="commit">if set to <c>true</c>, commit the unit of work.</param>
  98.     void PerformInNewUnitOfWork<T>(Action<IUnitOfWork> func, bool commit = false);
  99.  
  100.     /// <summary>
  101.     /// Performs the specified Func using a new unit of work, with commits and rollbacks as necessary.
  102.     /// </summary>
  103.     /// <typeparam name="T"></typeparam>
  104.     /// <param name="func">The function to evaluate. The lambda or named method must accept an IUnitOfWork as a parameter.</param>
  105.     /// <returns>A single object of the generic type, returned by the function.</returns>
  106.     /// <param name="commit">if set to <c>true</c>, commit the unit of work.</param>
  107.     T PerformInNewUnitOfWork<T>(Func<IUnitOfWork, T> func, bool commit = false) where T : class, TRest;
  108.  
  109.     /// <summary>
  110.     /// Performs the specified Func using a new unit of work, with commits and rollbacks as necessary.
  111.     /// </summary>
  112.     /// <typeparam name="T"></typeparam>
  113.     /// <param name="func">The Function to evaluate. The lambda or named method must accept an IUnitOfWork as a parameter.</param>
  114.     /// <returns>An enumerable set of objects of the generic type, returned by the function.</returns>
  115.     /// <param name="commit">if set to <c>true</c>, commit the unit of work.</param>
  116.     IEnumerable<T> PerformInNewUnitOfWork<T>(Func<IUnitOfWork, IEnumerable<T>> func, bool commit = false) where T : class, TRest;
  117.  
  118.     /// <summary>
  119.     /// Attaches the specified domain object to the current Unit of Work, allowing operations to be performed on it.
  120.     /// </summary>
  121.     /// <typeparam name="T"></typeparam>
  122.     /// <param name="domainObject">The domain object.</param>
  123.     /// <param name="unitOfWork">The unit of work.</param>
  124.     void Attach<T>(T domainObject, IUnitOfWork unitOfWork) where T : class, TRest;
  125.  
  126.     /// <summary>
  127.     /// Detaches the specified domain object to the current Unit of Work.
  128.     /// </summary>
  129.     /// <typeparam name="T"></typeparam>
  130.     /// <param name="domainObject">The domain object.</param>
  131.     /// <param name="unitOfWork">The unit of work.</param>
  132.     void Detach<T>(T domainObject, IUnitOfWork unitOfWork) where T : class, TRest;
  133.  
  134.     /// <summary>
  135.     /// Refreshes the specified collection of persistent elements with the most recent persisted data.
  136.     /// </summary>
  137.     /// <typeparam name="T"></typeparam>
  138.     /// <param name="elements">The list of elements to refresh.</param>
  139.     /// <param name="unitOfWork">The Unit of Work under which to perform the operation.</param>
  140.     void Refresh<T>(IList<T> elements, IUnitOfWork unitOfWork) where T : class, TRest;
  141.  
  142.     /// <summary>
  143.     /// Deletes the specified domain object from the data store.
  144.     /// Usually performs a physical delete; logical deletes are most often done through updates.
  145.     /// </summary>
  146.     /// <typeparam name="T"></typeparam>
  147.     /// <param name="domainObject">The domain object to delete.</param>
  148.     /// <param name="unitOfWork">The unit of work under which to perform the operation.</param>
  149.     void Delete<T>(T domainObject, IUnitOfWork unitOfWork) where T : class, TRest;
  150. }