Several questions and bugs?

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
mrmiagi0101
Posts: 23
Joined: Tue 27 Feb 2018 13:43

Several questions and bugs?

Post by mrmiagi0101 » Tue 27 Feb 2018 14:32

Hello,

I'm using ED for EF Core Version (6.2.439) (just bought a license last week) and VS 2017.

My questions:
1) If I create a new model in VS 2017 with Add New Item -> Devart EF Core Model -> Database First: There is no way to enter name for created model file? It is always called as DB Name: "DatabaseNameModel.cs". I think in EF 6 there is a way to name Model...

2) I started to experiment with EF Core Template. If I add a StoredProdcedure, generated Code for DbParams always adds .Size = -1 and precision and scale are ignored completly. But that is not good for nvarchars, decimal... So I experimented with the method "GenerateContextDirectCallMethod" in the template and there are indeed properties on your "EntityParameter". But these poperties gets not filled from Stored Procedure Params? Why is this so? And why there is no way in Designer to change size, precision and scale for Params?

3) I have a sp like this:

Code: Select all

ALTER  PROCEDURE [Seek_ContainerBeweg]
			@Identnummer	nvarchar(16),
			@KundenNr	nvarchar(10),
			@Abteilung	nvarchar(10),
			@Container	nvarchar(10),
			@Eingang	bit,
			@Ausgang	bit,
			@Nummer	sql_variant,
			@Datum	numeric(8,0)
There you can see param @Nummer is sql_variant. If I add this SP to a model, the EF Core template generates this method:

Code: Select all

public void SeekContainerBeweg (string Identnummer, string KundenNr, string Abteilung, string Container, System.Nullable<bool> Eingang, System.Nullable<bool> Ausgang, string Nummer, System.Nullable<decimal> Datum)
Why is param @Nummer translated to string? It should be object.
And the command params get generated like this:

Code: Select all

DbParameter NummerParameter = cmd.CreateParameter();
                    NummerParameter.ParameterName = "Nummer";
                    NummerParameter.Direction = ParameterDirection.Input;
                    if (Nummer != null)
                    {
                        NummerParameter.Value = Nummer;
                    }
                    else
                    {
                        NummerParameter.DbType = DbType.String;
                        NummerParameter.Size = -1;
                        NummerParameter.Value = DBNull.Value;
                    }
                    cmd.Parameters.Add(NummerParameter);

                    DbParameter DatumParameter = cmd.CreateParameter();
                    DatumParameter.ParameterName = "Datum";
                    DatumParameter.Direction = ParameterDirection.Input;
                    if (Datum.HasValue)
                    {
                        DatumParameter.Value = Datum.Value;
                    }
                    else
                    {
                        DatumParameter.DbType = DbType.Decimal;
                        DatumParameter.Size = -1;
                        DatumParameter.Value = DBNull.Value;
                    }
                    cmd.Parameters.Add(DatumParameter);
                    cmd.ExecuteNonQuery();
Next Problem with this SP: If I call Update Model from DB, this SP is always marked as changed, but I didn't change anything:
Param "Nummer": ServerDataType, Length were changed.
Param "Datum": ServerDataType, Precision, Scale were changed.

4) In Visual Studio 2017, if I open the template file in editor: I can search for text like "param", but if I click "Find next" nothing happens. Although there are many other "param" in the text. This only happens in your template file

5) In ED I can search for "param" and I will find them all, good. But how can I access command with shortcuts? Even copy and past is not working with CTRL-C or CTRL-V? Is this normal?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Several questions and bugs?

Post by Shalex » Mon 05 Mar 2018 18:07

We are processing your request.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Several questions and bugs?

Post by Shalex » Tue 06 Mar 2018 12:53

mrmiagi0101 wrote:1) If I create a new model in VS 2017 with Add New Item -> Devart EF Core Model -> Database First: There is no way to enter name for created model file? It is always called as DB Name: "DatabaseNameModel.cs". I think in EF 6 there is a way to name Model...
The name of *.efml file is set in the Add New Item window. Also you change its name in Solution Explorer.
The name of model *.cs file can be changed in the following way: open *.efml, select diagram surface, press F4 (Properties), set a value of the Name property, then save *.efml to regenerate the code.

JIC: there is the Model Name As Files Prefix property in the EF Core template.
mrmiagi0101 wrote:2) I started to experiment with EF Core Template. If I add a StoredProdcedure, generated Code for DbParams always adds .Size = -1 and precision and scale are ignored completly. But that is not good for nvarchars, decimal... So I experimented with the method "GenerateContextDirectCallMethod" in the template and there are indeed properties on your "EntityParameter". But these poperties gets not filled from Stored Procedure Params? Why is this so? And why there is no way in Designer to change size, precision and scale for Params?
We will notify you when the Size, Precision, Scale settings are added to Method Editor > Parameters.
mrmiagi0101 wrote:3) I have a sp like this:

Code: Select all

ALTER  PROCEDURE [Seek_ContainerBeweg]
			@Identnummer	nvarchar(16),
			@KundenNr	nvarchar(10),
			@Abteilung	nvarchar(10),
			@Container	nvarchar(10),
			@Eingang	bit,
			@Ausgang	bit,
			@Nummer	sql_variant,
			@Datum	numeric(8,0)
There you can see param @Nummer is sql_variant. If I add this SP to a model, the EF Core template generates this method:

Code: Select all

public void SeekContainerBeweg (string Identnummer, string KundenNr, string Abteilung, string Container, System.Nullable<bool> Eingang, System.Nullable<bool> Ausgang, string Nummer, System.Nullable<decimal> Datum)
Why is param @Nummer translated to string? It should be object.
And the command params get generated like this:

Code: Select all

DbParameter NummerParameter = cmd.CreateParameter();
                    NummerParameter.ParameterName = "Nummer";
                    NummerParameter.Direction = ParameterDirection.Input;
                    if (Nummer != null)
                    {
                        NummerParameter.Value = Nummer;
                    }
                    else
                    {
                        NummerParameter.DbType = DbType.String;
                        NummerParameter.Size = -1;
                        NummerParameter.Value = DBNull.Value;
                    }
                    cmd.Parameters.Add(NummerParameter);

                    DbParameter DatumParameter = cmd.CreateParameter();
                    DatumParameter.ParameterName = "Datum";
                    DatumParameter.Direction = ParameterDirection.Input;
                    if (Datum.HasValue)
                    {
                        DatumParameter.Value = Datum.Value;
                    }
                    else
                    {
                        DatumParameter.DbType = DbType.Decimal;
                        DatumParameter.Size = -1;
                        DatumParameter.Value = DBNull.Value;
                    }
                    cmd.Parameters.Add(DatumParameter);
                    cmd.ExecuteNonQuery();
Default mapping of Entity Developer can be set manually:
* standalone via Tools > Options > Servers' Options > SQL Server
* embedded into Visual Studio via Tools > Entity Developer > Options > Servers Options > SQL Server

We will fix two issues:
a) now if you set mapping sql_variant -> Object manually, the tool ignores this and maps to String
b) sql_variant -> Object will be a default setting of Entity Developer
mrmiagi0101 wrote:Next Problem with this SP: If I call Update Model from DB, this SP is always marked as changed, but I didn't change anything:
Param "Nummer": ServerDataType, Length were changed.
Param "Datum": ServerDataType, Precision, Scale were changed.
We will notify you when the bug is fixed.
mrmiagi0101 wrote:4) In Visual Studio 2017, if I open the template file in editor: I can search for text like "param", but if I click "Find next" nothing happens. Although there are many other "param" in the text. This only happens in your template file
That is a known bug. We cannot provide any timeframe at the moment.
mrmiagi0101 wrote:5) In ED I can search for "param" and I will find them all, good. But how can I access command with shortcuts? Even copy and past is not working with CTRL-C or CTRL-V? Is this normal?
Please right click a predefined template in the Templates node of the Model Explorer window and select the Copy to Model Folder option in the context menu. After this, you can edit it.
Does this help? If not, navigate to Tools > Options > Environment > Keyboard and press Reset.

JIC: custom (or user-defined) templates can be easily made shared using the Make Shared context menu option. This allows using custom templates in other models

mrmiagi0101
Posts: 23
Joined: Tue 27 Feb 2018 13:43

Re: Several questions and bugs?

Post by mrmiagi0101 » Wed 07 Mar 2018 07:22

Hi,

thank you for the work. I like your Entity Developer very much. I think I will present it in some weeks in our company, probably we will decide to use it in production development.

Only with point 5, I think we have a misunderstanding. I mean, in ED Standalone tool, if I have a template file already in editor, in editor there are no keyboard shortcuts. It is very annoying to copy some code per contextmenu "Copy" and paste it with "Paste". I want to use CTRL-C, CTRL-V and CTRL-F or F3 for searching. Is there a way?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Several questions and bugs?

Post by Shalex » Wed 07 Mar 2018 18:50

mrmiagi0101 wrote:Only with point 5, I think we have a misunderstanding. I mean, in ED Standalone tool, if I have a template file already in editor, in editor there are no keyboard shortcuts. It is very annoying to copy some code per contextmenu "Copy" and paste it with "Paste". I want to use CTRL-C, CTRL-V and CTRL-F or F3 for searching. Is there a way?
We cannot reproduce the issue at the moment.
1. Please confirm that you saved your *.efml model on your file system and copied a predefined template to a model folder (via its context menu in Model Explorer).
2. Send us a test model (*.efml, *.edps, *.tmpl) and specify the exact steps we should follow for reproducing.

mrmiagi0101
Posts: 23
Joined: Tue 27 Feb 2018 13:43

Re: Several questions and bugs?

Post by mrmiagi0101 » Wed 07 Mar 2018 20:52

Hi,

I think we still have talk about other things. But I try it again:

1) Open EntityDeveloper.exe
2) File ->New Model...
3) Ef Core Model ->Create
4) Model First -> Next ->Next ->Next-> Finish
5) In ModelExplorer Panel double click Template "EF Core"
6) Select some Text, e.g. template language="C#". Try to copy this this text to clipboard with keyboard shortcut "CTRL-C" .

=> This is not working! In every editor I know I can copy text with CTRL-C and paste it with CTRL-V. But your Entity Developer Tool seems not to know the common Shortcuts? This is my question.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Several questions and bugs?

Post by Shalex » Mon 12 Mar 2018 19:36

Please follow these steps:

1) Open EntityDeveloper.exe
2) File ->New Model...
3) Ef Core Model ->Create
4) Model First -> Next ->Next ->Next-> Finish. Save the *.efml model. Right click a predefined template in the Templates node of the Model Explorer window and select the Copy to Model Folder option in the context menu. After this, you can edit it.
5) In ModelExplorer Panel double click Template "EF Core"
6) Select some Text, e.g. template language="C#". Try to copy this this text to clipboard with keyboard shortcut "CTRL-C"

In case you do not copy template to model folder, you can CTRL-C in a predefined template and, then, CTRL-V to some other text file.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Several questions and bugs?

Post by Shalex » Fri 30 Mar 2018 16:47

Refer to viewtopic.php?f=32&t=36964:
  • The bug with the Find Next functionality of T4 Editor embedded into Visual Studio is fixed
  • The new SQL Type, Size, Precision, Scale options are added to the Parameters tab in Method Editor of EF Core Model
  • Mapping of sql_variant is fixed

Post Reply