Page 1 of 1

How to use JS Designer in the ASP.NET CORE (NET 461)?

Posted: Wed Apr 25, 2018 8:52 am
by 5441323@qq.com
here is my code ,but connect to database error:

[HttpPost]
[Route("api/handler")]
public IActionResult Handler(CommandJson command)
{

Result result = new Result();

if (command.Database == "MySQL") result = MySQLAdapter.Process(command);

if (command.Database == "Firebird") result = FirebirdAdapter.Process(command);

if (command.Database == "MS SQL") result = MSSQLAdapter.Process(command);

if (command.Database == "PostgreSQL") result = PostgreSQLAdapter.Process(command);

return new ObjectResult(result);

}

Re: How to use JS Designer in the ASP.NET CORE (NET 461)?

Posted: Wed Apr 25, 2018 1:38 pm
by 5441323@qq.com
Nothing worse than that.
I solved the problem myself from use my custom adapter in asp.net core .
by the way, the sample adapter for asp.net is very bad!!!!

here is my solution :

1.modify asp.net core project ,support text/plain content type.

2.use post and entity class serilize object .

3.use custom adapter ( its very import for that, could not use static Adapter class !!!)

like this:
public class MSSQLAdapter
{
public Result Process(CommandJson command)
{
var connection = new SqlConnection(command.ConnectionString);

connection.Open();

try
{
if (!String.IsNullOrEmpty(command.QueryString))
{
var sqlCommand = new SqlCommand(command.QueryString, connection);

var reader = sqlCommand.ExecuteReader();

var columns = new List<string>();

var rows = new List<string[]>();

for (var index = 0; index < reader.FieldCount; index++)
{
columns.Add(reader.GetName(index));
}

while (reader.Read())
{
var row = new string[reader.FieldCount];
for (var index = 0; index < reader.FieldCount; index++)
{
object value = null;
if (!reader.IsDBNull(index)) value = reader.GetValue(index);
if (value == null) value = "";
row[index] = value.ToString();

}
rows.Add(row);
}

return new Result { Success = true, Columns = columns.ToArray(), Rows = rows.ToArray() };

}
else
{

return new Result { Success = true };
}
}
catch (Exception e)
{

return new Result { Success = false, Notice = e.Message };

}
finally
{
if (connection.State != ConnectionState.Closed)
{

connection.Close();
}
}

}
}

use:
[HttpPost]
[Route("api/handler")]
public IActionResult Handler(CommandJson command)
{

Result result = new Result();

if (command.Database == "MS SQL") result = new MSSQLAdapter().Process(command);

return new ObjectResult(result);
}

fuck!!!

Re: How to use JS Designer in the ASP.NET CORE (NET 461)?

Posted: Wed Apr 25, 2018 8:18 pm
by HighAley
Hello.

You don't need to make any changes in the database adapters.
Just specify the path to it.
What version of our product do you use?
There is no JS engine on our current builds of .Net Core components.

Thank you.

Re: How to use JS Designer in the ASP.NET CORE (NET 461)?

Posted: Fri Apr 27, 2018 3:29 am
by 5441323@qq.com
HighAley wrote:Hello.

You don't need to make any changes in the database adapters.
Just specify the path to it.
What version of our product do you use?
There is no JS engine on our current builds of .Net Core components.

Thank you.
thank you very much.

But, once again,we use JS Designer in asp .Net Core . version 18.2 Trial
so,we have to modify adaper .
now,JS Designer run in asp .Net Core project perfect .

finally ,hope .Net Core official sample with js Designer .

Re: How to use JS Designer in the ASP.NET CORE (NET 461)?

Posted: Fri Apr 27, 2018 2:13 pm
by Lech Kulikowski
Hello,

Thank you for the information.

We have added this task in our to-do list.

Thank you.

Re: How to use JS Designer in the ASP.NET CORE (NET 461)?

Posted: Fri Apr 27, 2018 2:16 pm
by Lech Kulikowski
Hello,

Also, you can use our native Core components:
https://github.com/stimulsoft/Samples-N ... MVC-CSharp

Thank you.