اشتراک‌ها
آیا برای کلید اصلی یک جدول بانک اطلاعاتی GUID بهتر است یا INT؟

Criteria

GUIDs

Seq. GUIDs

BIGINT

INT

Storage

16 bytes

16 bytes

8 bytes

4 bytes

Insert/Update performance

Slowest

Comparable but the index keys are larger in size. For wider tables, this would be slower than Integer values.

Faster than sequential GUIDs

Fastest

Hotspot contention

Very rare

Yes

Yes

Highest, due to smaller size of RIDs

Fragmentation/Page Splits

High

Minimal

Minimal

Minimal

JOIN Performance/SORT operations

Least performance

(Rank 4 = Least performance)

Better than random GUIDs due lesser fragmentation (Rank: 3)

High performance (Rank: 2)

High

Performance

(Rank: 1)

Logical reads

Rank 4=Highest

Rank 3

Rank 2

Rank 1=Least

Merging data across servers

Beneficial

Beneficial

Difficult

Difficult

Uniqueness

Rare chance of duplicates

Globally unique. Virtually no chance of collisions

Limited by range of BIGINT

Limited by range of INT

آیا برای کلید اصلی یک جدول بانک اطلاعاتی GUID بهتر است یا INT؟
اشتراک‌ها
کتاب رایگان Go Succinctly

The Go programming language is relatively small and concise, but its depth makes it an ideal option for solving modern-day development problems. In Go Succinctly, author Mark Lewin guides readers through the basics of Go, and he provides documentation and resources that allow users to dive into the language and learn it for themselves. By the end of the book, novices and experienced programmers alike will be conversant in a language quickly gaining traction around the world.

Table of Contents
  1. Welcome
  2. Introducing Go
  3. Let’s Go!
  4. Variables, Constants, and Assignments
  5. Basic Data Types
  6. Control Structures
  7. Arrays, Slices, and Maps
  8. User-Defined Types
  9. Concurrency
  10. Standard Packages
  11. Go Further 
کتاب رایگان Go Succinctly
بازخوردهای پروژه‌ها
Fill and FillByObject
متود زیر برای تولید عبارت مبتنی بر الگو زمانی که الگو پیچیده‌تر از این است که بشود با string.Format به راحتی پیاده سازی شود ولی چندان هم پیچیده نیست که ابزارهای حرفه ای‌تری مانند T4 یا Razor به کار بیایند، میتواند مورد استفاده قرار گیرد:
        /// <summary>
        /// Insert values from an object into a string pattern. To specify the object's property you have to use the '{propertyName}'.
        /// </summary>
        /// <remarks>
        /// This method is a replacement to String.Format, but it has two differences:
        /// <list type="simple">
        /// <item>It reverese the order you call the functionality, instead of writing String.Format(pattern, args) you write pattern.FillByObject(args). This makes the code look cleaner.</item>
        /// <item>You supply the pattern with an object and specify insertion points by property names.</item>
        /// </list>
        /// <example>
        /// <![CDATA[
        /// "First name:{firstName}, Sur name:{Surname}".FillByObject(new {firstName = "Sam", lastName="Naseri"});
        /// ]]>
        /// </example>
        /// </remarks>
        /// <seealso cref="Fill"/>
        /// <typeparam name="T">Type of bindingValue.</typeparam>
        /// <param name="bindingPattern">The pattern to fill.</param>
        /// <param name="bindingValue">The object providing values to fill in the pattern.</param>
        /// <returns>The pattern filled with values.</returns>
        public static string FillByObject<T>(this string bindingPattern, T bindingValue)
        {
            var properties = GetProperties(typeof(T)).ToList();
            var values = properties.Select(property => property.GetValue(bindingValue, new object[] { })).ToList();
            var result = bindingPattern;
            for (int index = 0; index < properties.Count; index++)
            {
                var property = properties[index];
                var propPattern = "{" + property.Name + "}";
                var old = result;
                result = result.Replace(propPattern, values[index] != null ? values[index].ToString() : "");
            }
            return result;
        }

پیاده سازی فوق یک پیاده سازی بسیار خام و بسیار کند است و جای بهبود زیادی دارد. من فقط برای سناریوهای ساده که کارایی مطرح نیست استفاده از متود فوق را توصیه میکنم.
متودهای جانبی مورد نیاز:
private static IEnumerable<PropertyInfo> GetProperties(Type t)
{
    return t.GetProperties(BindingFlags.Public | BindingFlags.Instance);
}

همچنین متود زیر هم میتواند نوشتن string.Format را یک خرده ساده‌تر کند:
/// <summary>
/// A simple replacement for String.Format which only makes the codes look nicer.
/// </summary>
/// <param name="pattern">The source string that you want to replace insertion points on it.</param>
/// <param name="args">Values to be replaced in the pattern.</param>
/// <returns></returns>
public static string Fill(this string pattern, params object[] args)
{
    return string.Format(pattern, args);
}

اشتراک‌ها
Visual Studio 2022 17.2 منتشر شد

This release brings continued improvements to the C# and .NET experiences, new Git performance and experiences, updates for C++ developers, and new Azure tools for local development and deployment. We also continue to address your direct feedback submitted via Developer Community, addressing over 400 feedback items in this release! You can see the broader list of community feedback addressed in releases by visiting the fixes page on Developer Community. 

Visual Studio 2022 17.2 منتشر شد
اشتراک‌ها
ASP.NET Core 2.1.0-rc1 منتشر شد

This is a "go live" release that can be used in production with the understanding that you will need to update to the final stable release once it is available.  

ASP.NET Core 2.1.0-rc1 منتشر شد
اشتراک‌ها
بررسی GitHub Actions

A new feature recently introduced into Github, Github Actions allow you to automate your workflow by letting Github take care of a number of processes which can be triggered by a variety of events on the platform, be it pushing code, making a release or creat 

بررسی GitHub Actions