نظرات مطالب
وادار کردن EF Code first به ساخت بانک اطلاعاتی پیش از شروع به کار برنامه
یکی از روش‌های تعریف رشته اتصالی است:
public class CustomContext : DbContext
{
     public CustomContext() :  base("AppConfigConnectionStringName") { }

// or
public class CustomContext : DbContext
{
    public CustomContext() :
            base(@"Data Source=(local);Initial Catalog=MyDBName;Integrated Security=True;Pooling=False") { }
روش دیگر :
var ctx = new MyContext();
ctx.Database.Connection.ConnectionString = "...";
و یا
Database.DefaultConnectionFactory = 
new SqlConnectionFactory(@"Data Source=(local);Initial Catalog=MyDBName;Integrated Security=True;Pooling=False");
و ...
پاسخ به بازخورد‌های پروژه‌ها
'System.Data.Entity.Core.EntityException'
من از visual studio 2013 و  SQL server 2014 استفاده میکنم.
در فایل Web.config
این تغییرات رو دادم باز هم نتیجه همون هستش.
 <connectionStrings>
    <clear />
    <add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=MVC5DB;Integrated Security = true" providerName="System.Data.SqlClient" />
  </connectionStrings>

.
.
.
.
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="Data Source=.;Integrated Security=True" />
      </parameters>
    </defaultConnectionFactory>

نظرات مطالب
چک لیست ارتقاء به HTTPS مخصوص یک برنامه‌ی ASP.NET MVC 5x
روشی بهتر برای مدیریت محتوای مخلوط (لینک به HTTP و HTTPS در یک صفحه) در مرورگرهای جدید

در مورد محتوای مخلوط و «اصلاح تمام آدرس‌هایی که پیشتر توسط برنامه تولید شده‌اند» در مطلب فوق نکته‌ای عنوان شده‌است. روش دیگر مدیریت آن که نیازی به اصلاح محتوای صفحات سایت را ندارد، استفاده از هدر امنیتی «Content-Security-Policy: upgrade-insecure-requests» است:
<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Strict-Transport-Security" value="max-age=16070400; includeSubDomains" />
        <add name="Content-Security-Policy" value="upgrade-insecure-requests;" />
      </customHeaders>
</httpProtocol>
کار این هدر ویژه ، ارتقاء خودکار لینک‌های درج شده‌ی در صفحات به نگارش‌های HTTPS آن‌ها است. برای مثال این تصویری است که پیش از اعمال این هدر جهت درخواست آدرس gravatar یک کاربر ارسال شده‌است و اخطار محتوای مخلوط را می‌دهد:


و این تصویری است که پس از اعمال هدر upgrade-insecure-requests قابل مشاهده‌است که دیگر اخطار محتوای مخلوط را به همراه ندارد:
 

اشتراک‌ها
دوره کار با Angular 16 توسط Web API و Entity Framework Core

Angular 16 CRUD with .NET 7 Web API using Entity Framework Core - Full Course

📑 Contents:
00:00:00 Video Introduction
00:00:40 Angular and ASP.NET Core Udemy Course Demo
00:03:07 Prerequisites
00:03:37 Setting Up Development Environment
00:15:37 Create ASP.NET Core Web API
00:20:07 Understanding Files and Folder Structure
00:25:37 Understanding REST and HTTP Verbs
00:30:10 Create .NET 6 Web API
00:32:41 Our Project and Domain Models
00:41:16 Installing Nuget Packages For Entity Framework Core
00:43:06 DbContext
00:59:26 Running EF Core Migrations
01:03:26 Create Controllers and Actions
01:23:46 Repository Pattern
01:36:46 Create New Angular Application using Angular CLI
01:50:09 Angular Components
02:13:29 CRUD in Angular and ASP.NET Core Web APIs
02:17:21 Angular Forms
02:26:59 Angular Services
02:38:09 CORS
02:42:09 Unsubscribing
 

دوره کار با Angular 16 توسط Web API و Entity Framework Core
اشتراک‌ها
مصاحبه کامل با خالق ++C

Full Interview With the Creator of C++

By popular demand, and a request from the man himself, we’ve decided to release the full interview with esteemed computer scientist Bjarne Stroustrup (aka the creator of C++). We cover a bunch of topics so check the chapters to find what interests you the most! Filmed last year. Enjoy and happy trails!

00:00-02:42 Getting into programming
02:42-03:26 Programming being versatile
03:26-06:07 Industry changes
06:07-10:20 Inventing and maintaining C++
10:20-12:02 Key to making a successful language
12:02-16:04 Greatest lessons
16:14-20:06 Moving to the US
20:06-23:20 Advice to devs 

مصاحبه کامل با خالق ++C
اشتراک‌ها
دوره مقدماتی 9 ساعته زبان Go

A 9-Hour Go Course for Beginners

⭐️ Contents ⭐️
(0:00:00) Intro
(0:03:17) Ch 1. Why write Go?
(0:27:39) Ch 2. Variables
(0:51:11) Ch 3. Functions
(1:16:58) Ch 4. Structs
(1:34:36) Ch 5. Interfaces
(2:00:26) Ch 6. Errors
(2:22:01) Ch 7. Loops
(2:48:21) Ch 8. Slices
(3:39:54) Ch 9. Maps
(4:06:19) Ch 10. Advanced functions
(4:31:03) Ch 11. Pointers
(4:48:02) Ch 12. Local development
(5:31:43) Ch 13. Channels & concurrency
(6:07:38) Ch 14. Mutexes
(6:30:56) Ch 15. Generics
(6:38:38) Ch 16. Quiz
(6:43:13) P1. RSS aggregator project
(6:53:43) P2. Chi router
(7:11:37) P3. Postgres database
(7:39:10) P4. Authentication w/ API keys
(8:18:28) P5. Many to many relationships
(8:39:13) P6. Aggregation worker
(9:05:28) P7. Viewing blog posts 

دوره مقدماتی 9 ساعته زبان Go
اشتراک‌ها
آیا برای کلید اصلی یک جدول بانک اطلاعاتی 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؟
نظرات مطالب
کار با Docker بر روی ویندوز - قسمت دوم - نصب Docker
سلام، 
من Docker ورژن 2.4 را روی Windows 10 Enterprise LTSC ورژن 1809 نصب کردم، متاسفانه پیش فرض روی Container Linux قرار می‌گیره، هر وقت بخوام Switch کنم روی Container Windows با خطا مواجه می‌شم، خطایی که در Event Viewer ویندوز می‌بینم، به شرح زیر :
failed to start daemon: Error initializing network controller: Error creating default network: failed during hnsCallRawResponse: hnsCall failed in Win32: There are no more endpoints available from the endpoint mapper. (0x6d9) 
مشخصات کامپیوتر من، 
Ram: 32 G
CPU: 7i-8565U
مشخصات داکر:
Client: Docker Engine - Community
 Cloud integration  0.1.18
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:00:27 2020
 OS/Arch:           windows/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:07:04 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683 
نظرات مطالب
ویژگی Batching در EF Core
کدهای معادل مطلب فوق در EF 6.x را از اینجا دریافت کنید: EF6TestBatching.zip
این کدها برای حالت انجام 2 به روز رسانی و 6 ثبت، کدهای SQL زیر را تولید می‌کنند:
UPDATE [dbo].[Blogs]
SET [Url] = @0
WHERE ([BlogId] = @1)
-- @0: 'http://sample.com/blogs/dogs' (Type = String, Size = -1)
-- @1: '1' (Type = Int32)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 19 ms with result: 1

UPDATE [dbo].[Blogs]
SET [Url] = @0
WHERE ([BlogId] = @1)
-- @0: 'http://sample.com/blogs/cats' (Type = String, Size = -1)
-- @1: '2' (Type = Int32)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 47 ms with result: 1

INSERT [dbo].[Blogs]([Name], [Url])
VALUES (@0, @1)
SELECT [BlogId]
FROM [dbo].[Blogs]
WHERE @@ROWCOUNT > 0 AND [BlogId] = scope_identity()
-- @0: 'The Horse Blog' (Type = String, Size = -1)
-- @1: 'http://sample.com/blogs/horses' (Type = String, Size = -1)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 31 ms with result: SqlDataReader

INSERT [dbo].[Blogs]([Name], [Url])
VALUES (@0, @1)
SELECT [BlogId]
FROM [dbo].[Blogs]
WHERE @@ROWCOUNT > 0 AND [BlogId] = scope_identity()
-- @0: 'The Snake Blog' (Type = String, Size = -1)
-- @1: 'http://sample.com/blogs/snakes' (Type = String, Size = -1)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 73 ms with result: SqlDataReader

INSERT [dbo].[Blogs]([Name], [Url])
VALUES (@0, @1)
SELECT [BlogId]
FROM [dbo].[Blogs]
WHERE @@ROWCOUNT > 0 AND [BlogId] = scope_identity()
-- @0: 'The Fish Blog' (Type = String, Size = -1)
-- @1: 'http://sample.com/blogs/fish' (Type = String, Size = -1)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 49 ms with result: SqlDataReader

INSERT [dbo].[Blogs]([Name], [Url])
VALUES (@0, @1)
SELECT [BlogId]
FROM [dbo].[Blogs]
WHERE @@ROWCOUNT > 0 AND [BlogId] = scope_identity()
-- @0: 'The Koala Blog' (Type = String, Size = -1)
-- @1: 'http://sample.com/blogs/koalas' (Type = String, Size = -1)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 49 ms with result: SqlDataReader

INSERT [dbo].[Blogs]([Name], [Url])
VALUES (@0, @1)
SELECT [BlogId]
FROM [dbo].[Blogs]
WHERE @@ROWCOUNT > 0 AND [BlogId] = scope_identity()
-- @0: 'The Parrot Blog' (Type = String, Size = -1)
-- @1: 'http://sample.com/blogs/parrots' (Type = String, Size = -1)
-- Executing at 16/06/1396 02:31:41 ب.ظ +04:30
-- Completed in 26 ms with result: SqlDataReader

INSERT [dbo].[Blogs]([Name], [Url])
VALUES (@0, @1)
SELECT [BlogId]
FROM [dbo].[Blogs]
WHERE @@ROWCOUNT > 0 AND [BlogId] = scope_identity()
-- @0: 'The Kangaroo Blog' (Type = String, Size = -1)
-- @1: 'http://sample.com/blogs/kangaroos' (Type = String, Size = -1)
-- Executing at 16/06/1396 02:31:42 ب.ظ +04:30
-- Completed in 38 ms with result: SqlDataReader
یعنی در کل 8 بار رفت و برگشت به بانک اطلاعاتی صورت گرفته‌است (هر Executing در اینجا یعنی یکبار رفت و برگشت)؛ در مقابل تنها یکبار رفت و برگشت به بانک اطلاعاتی در حالت استفاده‌ی از EF Core (با تنظیمات پیش فرض آن).
جمع کل مدت زمان عملیات در اینجا 332 میلی ثانیه است در مقایسه با 44 میلی ثانیه EF Core. یعنی EF 6.x در حالت insert/update/delete چیزی حدود 86 درصد از نمونه‌ی EF Core کندتر است و این مورد اهمیت batching و کاهش تعداد رفت و برگشت‌های به بانک اطلاعاتی است که به صورت پیش فرض در EF Core فعال است.
اشتراک‌ها
پیاده سازی سرویس دیسکاوری با Consul

بعد از مدت‌ها دوری از این پلی لیست، گفتیم یکمی این رو هم ببریم جلو و یه ویدیو براش بسازیم در ادامه بحث مایکروسرویس ها، این سری رفتیم سراغ سرویس دیسکاوری و با Consul که از کمپانی HashiCorp هست، کار کردیم و تونستیم مایکروسرویس هارو در زمان لود رجیستر کنیم و Ocelot رو هم به این سرویس دیسکاوری وصل کنیم. 

00:00 Ocelot, API Gateway 

05:00 Implementing 2 Microservices and API Gateway 

10:08 What is Consul 

10:37 Running Consul in Docker 

15:31 Consul UI 

16:40 Self Registration Microservice into Consul 

20:28 IHostedService 

27:15 Register Services into IServiceCollection 

35:00 Connect Ocelot to Consul 

مدت زمان ویدیو : 41 دقیقه 

پیاده سازی سرویس دیسکاوری با Consul