- Save only once per task and don't use transactions. See https://coderwall.com/p/jnniww/why-you-shouldn-t-use-entity-framework-with-transactions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ... | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
/// <summary> | |
/// Provides static methods that aid in performing reflection related operations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open the find/replace (in files) dialog. | |
Enable regular expressions. | |
Replace | |
([\n]*)([\s]*)([\n]*){([\s])([\n])([\s]*)get;([\n]*)([\s]*)set;([\s])([\n])([\s]*)} | |
by | |
{ get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
public class CustomException : Exception | |
{ | |
public CustomException() { } | |
public CustomException(string message) : base(message) { } | |
public CustomException(string message, System.Exception innerException) : base(message, innerException) { } | |
public override void GetObjectData(SerializationInfo info, StreamingContext context) | |
{ | |
//... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClass : IDisposable | |
{ | |
/// <summary> | |
/// Finalizes an instance of the <see cref="MyClass"/> class. Releases unmanaged | |
/// resources and performs other cleanup operations before the current instance is | |
/// reclaimed by garbage collection. | |
/// </summary> | |
~MyClass() | |
{ | |
this.Dispose(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq.Expressions; | |
/// <summary> | |
/// Returns the name of the specified property of the specified type. | |
/// </summary> | |
/// <typeparam name="T">The type the property is a member of.</typeparam> | |
/// <param name="property">The property expression.</param> | |
/// <returns>The property name.</returns> | |
public static string GetPropertyName<T>(Expression<Func<T, object>> property) | |
{ |