Working with packages and libraries in .NET Core

If you want to develop a modern web application, you will realize very quickly that you can’t write everything on your own. You will rely on some third party client and server side libraries and components to increase your development speed. There are many online code repositories and sources available to developers these days and downloading and keeping track of all third-party packages can be a painful task

Read more here.

Adding byte to byte array

There are two methods. either to create a new array or resize the existing array;

To resize existing array, do this;

Array.Resize(ref fileBytesArray, fileBytesArray.Length + 1);

To create a new array from existing one and resize, do this;

bArray = AddByteToArray(bArray,  newByte);

Here is the method;

public byte[] AddByteToArray(byte[] bArray, byte newByte)
{
    byte[] newArray = new byte[bArray.Length + 1];
    bArray.CopyTo(newArray, 1);
    newArray[0] = newByte;
    return newArray;
}

Reference

c# how to add byte to byte array

Data Points – Shrink EF Models with DDD Bounded Contexts

When defining models for use with the Entity Framework (EF), developers often include all of the classes to be used throughout the entire application. This might be a result of creating a new Database First model in the EF Designer and selecting all available tables and views from the database. For those of you using Code First to define your model, it might mean creating DbSet properties in a single DbContext for all of your classes or even unknowingly including classes that are related to those you’ve targeted.

Read more here;

SQL Server transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements

There are situations where you might receive this error message “Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.”. Even when using a TRY CATCH block in the stored procedure and a ROLLBACK in the catch block, this error still occurs. One reason this is not captured is because fatal errors are not caught and the transaction remains open. In this tip we will look at how you can handle this issue.

Refer to this article for solution;

SSDT Installation

Recent changes in Visual studio installer is breaking SSDT installation with this error;

We need to do an offline installation as outlined here;

https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017#ssdt-for-vs-2017-standalone-installer&WT.mc_id=DP-MVP-5003166

Download SSDT from here;

https://go.microsoft.com/fwlink/?linkid=2169967&WT.mc_id=DP-MVP-5003166

Download vs_sql.exe file from here;

https://aka.ms/vs/15/release/vs_sql.exe

Open DOS prompt as administrator and navigate to downloaded files
MS DOS
vs_sql.exe –layout C:\Business\Trash\SSDT\OfflineFiles –lang en-us

If there is error in download, type the command below to fix the error: (only do this if you also had download errors) ;

vs_SQL.exe –layout C:\SSDT2017 –fix

Navigate to the directory where you downloaded the layout files (in my case, C:\Business\Trash\SSDT\OfflineFiles)
vs_setup.exe –NoWeb

There’s not much to change here, just click on the Install button (or maybe change the installation path):

Once installation is done, we will be able to see a minimal version of VS2017.
Now we can install SQL Server Data Tools 2017 (SSDT) ​​through the normal installer (SSDT-Setup-ENU.exe), remembering to check the SSIS, SSRS and SSAS options:
SSDT-Setup-ENU

Once the installatin is successful, make sure the SQL Server project templates (Database Project / SQLCLR), Analysis Services (SSAS), Integration Services (SSIS) and Reporting Services (SSRS) are working normally.

You are done.

Update for VS2022

Microsoft added a public preview of the SQL Server Integration Services Projects 2022 to the Visual Studio marketplace, which is tested against Visual Studio 2022 17.4

You can read full discussion on stack overflow.

Reference

https://en.dirceuresende.com/blog/como-corrigir-erro-na-instalacao-do-sql-server-data-tools-ssdt-2017-setup-failed-incorrect-function-0x80070001/