JocaPC / Belgrade-SqlClient

Small async ADO.NET helper library
http://jocapc.github.io/Belgrade-SqlClient/
Other
93 stars 14 forks source link

CLR-Belgrade-SqlClient with .Net framework #6

Closed cissemy closed 6 years ago

cissemy commented 7 years ago

Hi, I trying to use CLR-Belgrade-SqlClient with .net framework : using System.Web.Http; using System.Web.Http.Cors; using Belgrade.SqlClient; using System.Threading.Tasks; using System.Data.SqlClient; using Belgrade.SqlClient.SqlDb;

namespace WebDataLayer.Controllers { [EnableCors(origins: "", headers: "", methods: "*")] [Route("api/[controller]")]

public class MyProductController : ApiController
{
    IQueryPipe sqlQuery = null;
    const string ConnString = "Server=.;Database=PWS;Integrated Security=true";

    public MyProductController(IQueryPipe sqlQueryService)
    {
        this.sqlQuery = sqlQueryService;
        //this.sqlQuery = new QueryPipe(new SqlConnection(ConnString));
    }
    // GET api/MyProduct/Load

    public async Task Load()
    {
       await sqlQuery.Stream("select * from Products for json path", Response.Body, "[]");

    }
}

} But Response.Body is causing an error . Also where can i call my connectionstring ConnString ? Thanks

JocaPC commented 6 years ago

You are correctly using the service.

Note that if you are using: this.sqlQuery = sqlQueryService;

then you should use dependency injection to configure the service. See examples here: https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/product-catalog.

cissemy commented 6 years ago

Hi Jovan, Let say , i have : await sqlCmd .Proc("InsertProduct") .Param("Product", product) .Exec();

How can I return the ID of the inserted product as json ? Thanks

On Sat, Feb 10, 2018 at 2:39 PM Jovan Popovic notifications@github.com wrote:

You are correctly using the service.

Note that if you are using: this.sqlQuery = sqlQueryService;

then you should use dependency injection to configure the service. See examples here: https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/product-catalog .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/CLR-Belgrade-SqlClient/issues/6#issuecomment-364683460, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiSRSofidHRAECcxA7IaLP6or8stUks5tTfBbgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

JocaPC commented 6 years ago

No, Exec don't returns anything. You should be able to use Map or Stream instead of Exec() when you execute InsertProduct and treat it as a procedure that has SELECT inside.

Take a look at the https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/ProductCatalog/CQRSTest.cs#L214 lines 215-218 where I used Map to fetch inserted id.

cissemy commented 6 years ago

Hi, I did try this : [HttpPost] public async Task Post() { string todo = new StreamReader(Request.Body).ReadToEnd(); var cmd = new SqlCommand( @"insert into Todo select * from OPENJSON(@todo) WITH( Title nvarchar(30), Description nvarchar(4000), Completed bit, TargetDate datetime2)"); cmd.Parameters.AddWithValue("todo", todo); // await SqlCommand.Sql(cmd).Exec(); await SqlCommand .Sql(cmd) .Map(row => { // Populate some C# object from the row data. row["Title"].ToString(); }); } But it is not returning the value row["Title"].ToString(); Thanks

On Sun, Oct 7, 2018 at 5:37 PM Jovan Popovic notifications@github.com wrote:

No, Exec don't returns anything. You should be able to use Map or Stream instead of Exec() when you execute InsertProduct and treat it as a procedure that has SELECT inside.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427689175, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiVU2HapDyNzyHCSqSkmGMP368PMiks5uinQKgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

JocaPC commented 6 years ago

Try to run this sql in SSMS and you will see that it don't return any column. Select in this query will select into the table. if you add some dummy ;SELECT 'a' as Title you wold get the result. You would need an output clause (maybe it would be better to use index instead of name because I'm ot sure are the column names associated to output statement ).

cissemy commented 6 years ago

Hi, I did what you said but still no value returned : [HttpPost] public async Task Post() { string todo = new StreamReader(Request.Body).ReadToEnd(); var cmd = new SqlCommand( @"insert into Todo select * from OPENJSON(@todo) WITH( Title nvarchar(30), Description nvarchar(4000), Completed bit, TargetDate datetime2);SELECT 'a' as Title "); cmd.Parameters.AddWithValue("todo", todo); // await SqlCommand.Sql(cmd).Exec(); await SqlCommand .Sql(cmd) .Map(row => { // Populate some C# object from the row data. row["Title"].ToString(); }); }

On Mon, Oct 8, 2018 at 2:23 AM Jovan Popovic notifications@github.com wrote:

Try to run this sql in SSMS and you will see that it don't return any column. Select in this query will select into the table. if you add some dummy ;SELECT 'a' as Title you wold get the result. You would need an output clause (maybe it would be better to use index instead of name because I'm ot sure are the column names associated to output statement ).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427731604, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiZlX6mR4RvS9cOi9LENR-L40Lepzks5uiu90gaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

JocaPC commented 6 years ago

Are you sure? I have created a unit test that do almost exact thing https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102 and it return the value:

image

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

Also, are you using the latest version of package?

cissemy commented 6 years ago

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic notifications@github.com wrote:

Are you sure? I have created a unit test that do almost exact thing https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102 and it return the value:

[image: image] https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 6 years ago

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic notifications@github.com wrote:

Are you sure? I have created a unit test that do almost exact thing https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102 and it return the value:

[image: image] https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 6 years ago

Hi, I did not get any reply back from you . Thanks

On Wed, Oct 10, 2018 at 10:05 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic notifications@github.com wrote:

Are you sure? I have created a unit test that do almost exact thing https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102 and it return the value:

[image: image] https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

JocaPC commented 6 years ago

I have no idea what is happening with your project. dotnet restore is failing with the following error:

C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1> dotnet restore Restoring packages for C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. [C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj]

When I copy your code in new valid project, I'm getting some config error like WebHost is not available so I don't understand what are you using.

When I just copy part of code that executed Map it works in my project.

My bling guess is that you are not sending valid JSON as an argument of post and that OPENJSON is sending some error that you are not caching so this is the reason why it fails. Try to stats with something like this: https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/todo-app/dotnet-rest-api

Regards, Jovan

On Fri, 12 Oct 2018 at 16:47, Mohamed Y. Cisse notifications@github.com wrote:

Hi, I did not get any reply back from you . Thanks

On Wed, Oct 10, 2018 at 10:05 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip < https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic notifications@github.com wrote:

Are you sure? I have created a unit test that do almost exact thing

https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102 and it return the value:

[image: image] < https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429351449, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGl5jSS5X9Xp1BXMH3LGH4M5EMpT_YAks5ukKuSgaJpZM4P9V6S .

cissemy commented 6 years ago

Hi Jovan, I will try. Thanks

On Fri, Oct 12, 2018 at 4:44 PM Jovan Popovic notifications@github.com wrote:

I have no idea what is happening with your project. dotnet restore is failing with the following error:

C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1> dotnet restore Restoring packages for C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. [C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj]

When I copy your code in new valid project, I'm getting some config error like WebHost is not available so I don't understand what are you using.

When I just copy part of code that executed Map it works in my project.

My bling guess is that you are not sending valid JSON as an argument of post and that OPENJSON is sending some error that you are not caching so this is the reason why it fails. Try to stats with something like this:

https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/todo-app/dotnet-rest-api

Regards, Jovan

On Fri, 12 Oct 2018 at 16:47, Mohamed Y. Cisse notifications@github.com wrote:

Hi, I did not get any reply back from you . Thanks

On Wed, Oct 10, 2018 at 10:05 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip <

https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic < notifications@github.com> wrote:

Are you sure? I have created a unit test that do almost exact thing

https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102

and it return the value:

[image: image] <

https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154

,

or mute the thread <

https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429351449 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABGl5jSS5X9Xp1BXMH3LGH4M5EMpT_YAks5ukKuSgaJpZM4P9V6S

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429456858, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUib40Bcf0kC7nwi0rwtW3GVqt78aoks5ukP9CgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 6 years ago

Hi, How is the performance of Belgrade-Sql compared to Mongodb ? Thanks & Regards

On Fri, Oct 12, 2018 at 8:09 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi Jovan, I will try. Thanks

On Fri, Oct 12, 2018 at 4:44 PM Jovan Popovic notifications@github.com wrote:

I have no idea what is happening with your project. dotnet restore is failing with the following error:

C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1> dotnet restore Restoring packages for C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. [C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj]

When I copy your code in new valid project, I'm getting some config error like WebHost is not available so I don't understand what are you using.

When I just copy part of code that executed Map it works in my project.

My bling guess is that you are not sending valid JSON as an argument of post and that OPENJSON is sending some error that you are not caching so this is the reason why it fails. Try to stats with something like this:

https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/todo-app/dotnet-rest-api

Regards, Jovan

On Fri, 12 Oct 2018 at 16:47, Mohamed Y. Cisse notifications@github.com wrote:

Hi, I did not get any reply back from you . Thanks

On Wed, Oct 10, 2018 at 10:05 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip <

https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic < notifications@github.com> wrote:

Are you sure? I have created a unit test that do almost exact thing

https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102

and it return the value:

[image: image] <

https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154

,

or mute the thread <

https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429351449 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABGl5jSS5X9Xp1BXMH3LGH4M5EMpT_YAks5ukKuSgaJpZM4P9V6S

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429456858, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUib40Bcf0kC7nwi0rwtW3GVqt78aoks5ukP9CgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

JocaPC commented 6 years ago

This is apple-to-oranges comparison. Belgrade-Sql works with SQl Server and you cannot compare SQL server to MongoDB. For comparison of different libraries for accessing SQL server see: https://github.com/StackExchange/Dapper#performance

Jovan

On Sat, 13 Oct 2018 at 16:57, Mohamed Y. Cisse notifications@github.com wrote:

Hi, How is the performance of Belgrade-Sql compared to Mongodb ? Thanks & Regards

On Fri, Oct 12, 2018 at 8:09 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi Jovan, I will try. Thanks

On Fri, Oct 12, 2018 at 4:44 PM Jovan Popovic notifications@github.com wrote:

I have no idea what is happening with your project. dotnet restore is failing with the following error:

C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1> dotnet restore Restoring packages for C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. [C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj]

When I copy your code in new valid project, I'm getting some config error like WebHost is not available so I don't understand what are you using.

When I just copy part of code that executed Map it works in my project.

My bling guess is that you are not sending valid JSON as an argument of post and that OPENJSON is sending some error that you are not caching so this is the reason why it fails. Try to stats with something like this:

https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/todo-app/dotnet-rest-api

Regards, Jovan

On Fri, 12 Oct 2018 at 16:47, Mohamed Y. Cisse < notifications@github.com> wrote:

Hi, I did not get any reply back from you . Thanks

On Wed, Oct 10, 2018 at 10:05 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip <

https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic < notifications@github.com> wrote:

Are you sure? I have created a unit test that do almost exact thing

https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102

and it return the value:

[image: image] <

https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154

,

or mute the thread <

https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429351449

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/ABGl5jSS5X9Xp1BXMH3LGH4M5EMpT_YAks5ukKuSgaJpZM4P9V6S

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429456858 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAFUib40Bcf0kC7nwi0rwtW3GVqt78aoks5ukP9CgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429548547, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGl5i_yQXQ_S6WZYbtOW3z_cXu_7hrJks5ukf9agaJpZM4P9V6S .

cissemy commented 6 years ago

Hi, I am talking about performance since with sql server 2016 you can save and retrieve data as json. With your tool i ask myself if there is even a need for nosql like mongodb. Thanks

On Sat, Oct 13, 2018 at 5:35 PM Jovan Popovic notifications@github.com wrote:

This is apple-to-oranges comparison. Belgrade-Sql works with SQl Server and you cannot compare SQL server to MongoDB. For comparison of different libraries for accessing SQL server see: https://github.com/StackExchange/Dapper#performance

Jovan

On Sat, 13 Oct 2018 at 16:57, Mohamed Y. Cisse notifications@github.com wrote:

Hi, How is the performance of Belgrade-Sql compared to Mongodb ? Thanks & Regards

On Fri, Oct 12, 2018 at 8:09 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi Jovan, I will try. Thanks

On Fri, Oct 12, 2018 at 4:44 PM Jovan Popovic < notifications@github.com> wrote:

I have no idea what is happening with your project. dotnet restore is failing with the following error:

C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1> dotnet restore Restoring packages for C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. [C:\Users\jovanpop\Documents\Visual Studio 2017\TodoWebApi\WebApplication1\WebApplication1.csproj]

When I copy your code in new valid project, I'm getting some config error like WebHost is not available so I don't understand what are you using.

When I just copy part of code that executed Map it works in my project.

My bling guess is that you are not sending valid JSON as an argument of post and that OPENJSON is sending some error that you are not caching so this is the reason why it fails. Try to stats with something like this:

https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/todo-app/dotnet-rest-api

Regards, Jovan

On Fri, 12 Oct 2018 at 16:47, Mohamed Y. Cisse < notifications@github.com> wrote:

Hi, I did not get any reply back from you . Thanks

On Wed, Oct 10, 2018 at 10:05 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, I sent you my code 2 days ago. Thanks & Regards

On Mon, Oct 8, 2018 at 4:07 PM CISSE M.Y. cissemy@gmail.com wrote:

Hi, Still does not work. Here is my table : CREATE TABLE [dbo].[Todo]( [Id] [int] IDENTITY(1,1) NOT NULL, [Title] nvarchar NOT NULL, [Description] nvarchar NULL, [Completed] [bit] NULL, [TargetDate] datetime2 NULL, PRIMARY KEY CLUSTERED ( [Id] ASC ) ) GO and my source code

TodoWebApi.zip <

https://drive.google.com/file/d/1KFrkUqxlOMhb5ieAabJi_1iaJFaRfd2w/view?usp=drive_web

On Mon, Oct 8, 2018 at 2:07 PM Jovan Popovic < notifications@github.com> wrote:

Are you sure? I have created a unit test that do almost exact thing

https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Test/Master/BasicQueryMapperTest.cs#L102

and it return the value:

[image: image] <

https://user-images.githubusercontent.com/1156582/46625707-49ffb480-cb35-11e8-9e7a-0358ff169a33.png

Could you try to rebuild/restart the app?

Could you try to create SqlMapper instead of SqlCommand?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-427928154

,

or mute the thread <

https://github.com/notifications/unsubscribe-auth/AAFUieDwl-KjzEJPuen-0bbMtkw2lqOtks5ui5RVgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429351449

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/ABGl5jSS5X9Xp1BXMH3LGH4M5EMpT_YAks5ukKuSgaJpZM4P9V6S

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429456858

,

or mute the thread <

https://github.com/notifications/unsubscribe-auth/AAFUib40Bcf0kC7nwi0rwtW3GVqt78aoks5ukP9CgaJpZM4P9V6S

.

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429548547 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABGl5i_yQXQ_S6WZYbtOW3z_cXu_7hrJks5ukf9agaJpZM4P9V6S

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/Belgrade-SqlClient/issues/6#issuecomment-429577108, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiWLa66ydohsfVwN2-IbMLSocStCeks5uklyNgaJpZM4P9V6S .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028