Base solution for your next web application
Open Closed

GetStartin questions #6805


User avatar
0
microgate created

Hi I have istalled everithing using Asp.Ner Core Mvc JQuery template and now i have used "ASP.NET Zero Power Tools" for import my Sql table in new database create with Asp Net Zero tables. i have some questions:

  • Can I import all my Sql tables in one step or i have to import every single table?
  • If my table to import, have a one to many relations, i have to first import the "child" table?
  • As you can see in attached file (Difference.JPG), the data types of tables are different (nvarchar(MAX)) and in a new table the PK is change. Is possible to change this behavior?
  • If i have to import table by table, what happens to relationships between tables (now the PK is change). Are they imported or not? And about Navigation Property of Entities, can i navigate from one object and its collection (one to many db relation) like Customer.Adresses?
  • Is possible to delete one table and all created classes with some tool?
  • The table Customer is empty (no records). Why the html page retrive a validtion error (attached file "GetCustomerPage.JPG")?
  • In which project are the methods of CRUD vai Rest API exposed?

Regards Gianni


9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can I import all my Sql tables in one step or i have to import every single table?

    No, you have to do it one by one.

    If my table to import, have a one to many relations, i have to first import the "child" table?

    Yes, it would be more appropriate.

    As you can see in attached file (Difference.JPG), the data types of tables are different (nvarchar(MAX)) and in a new table the PK is change. Is possible to change this behavior?

    Yes, you can edit the type of properties before creating your entity, see:

    If i have to import table by table, what happens to relationships between tables (now the PK is change). Are they imported or not? And about Navigation Property of Entities, can i navigate from one object and its collection (one to many db relation) like Customer.Adresses?

    No, the relations are not imported. Just note that, RAD Tool doesn't import your data from old database. It just creates an entity in AspNet Zero's database. You have to import your data after RAD Tool create tables in AspNet ero's database.

    Is possible to delete one table and all created classes with some tool?

    No. I suggest you to use source control for this. You can revert changes easily.

    The table Customer is empty (no records). Why the html page retrive a validtion error (attached file "GetCustomerPage.JPG")?

    We will test this and get back to you. Normally there shouldn't be such an error.

    In which project are the methods of CRUD vai Rest API exposed?

    It is the MVC project. You can test it as explained in here

  • User Avatar
    0
    microgate created

    Hi ismcagdas, thanks for your answer

    I think that import my sql table in your DB (the new db that contains all your Sqltable) is impossibile in that i loose the table relations. So i think is better use 2 different DB. I think is possible, but in this situation, how i have to configure the connection strings in all projects? And how does it work with 2 connnection strings?

    For create the entities code (and all files for manage my tables like Dto, services, ecc) is better using Asp Net Zero Enity Generator, or another tool? If i must use Enity Generator, i think i don't have to check "Update Database"...and what about "Add Migration"? What is the difference?

    When i import a table with your tool, are creted many files and in "*.Application" project in "CustomersAppService" i can test with Postman the Api Rest services. This is grat, but how i can know the Verbs of these service? There anen't the attribute (es. [HttpPost])...how can work?

    "We will test this and get back to you. Normally there shouldn't be such an error." --> ok let me know

    "No. I suggest you to use source control for this. You can revert changes easily." --> Now I'm using "Generate Demo Project", i thik i can create different ok this project for testing and delete quickly some errors. In Production enviroment, all my code will be under source control.

    Regards Gianni

  • User Avatar
    0
    microgate created

    Hi ismcagdas

    Another question: as you can see in attached file, i have import a TestResults classes (without table). The Html page was created, but correctly if i save, an error is raised ("Error Save because no table.JPG"). My problem is that a insert hatml page ("CreateMask Html.JPG") show the foregn key as a textbox and not like a combobox. In this file "Table.JPG" you can see my table. I expect to have a ComboBox when there are FK and about this I think that the software should know the relationships between tables and the PK will be hidden.

    Do I need to intervene manually to change the TextBox in ComboBox or can I do it via tool? Obviously it also serves the code to load data from the DB (here I wait for the reply to the previous post if you can use 2 DB).

    Other question: is possible to create a Master Detail web form?

    Regards Gianni

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think that import my sql table in your DB (the new db that contains all your Sqltable) is impossibile in that i loose the table relations. So i think is better use 2 different DB. I think is possible, but in this situation, how i have to configure the connection strings in all projects? And how does it work with 2 connnection strings?

    You can use a second DbContext, you can check our sample here https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/MultipleDbContextEfCoreDemo. But, I suggest you to move your tables to AspNet Zero database. It will make your development easier for the future.

    For create the entities code (and all files for manage my tables like Dto, services, ecc) is better using Asp Net Zero Enity Generator, or another tool? If i must use Enity Generator, i think i don't have to check "Update Database"...and what about "Add Migration"? What is the difference?

    Yes, you can do it like that. Don't add migration at first. Define the relations between your entities and add a single migration for all of your entities at once.

    When i import a table with your tool, are creted many files and in "*.Application" project in "CustomersAppService" i can test with Postman the Api Rest services. This is grat, but how i can know the Verbs of these service? There anen't the attribute (es. [HttpPost])...how can work?

    It is conventional unless you use an attribute. You can check documentation for more information.

    "We will test this and get back to you. Normally there shouldn't be such an error." --> ok let me know

    Sorry, couldn't test it yet.

    "No. I suggest you to use source control for this. You can revert changes easily." --> Now I'm using "Generate Demo Project", i thik i can create different ok this project for testing and delete quickly some errors. In Production enviroment, all my code will be under source control.

    Good.

    For your second post:

    Another question: as you can see in attached file, i have import a TestResults classes (without table). The Html page was created, but correctly if i save, an error is raised ("Error Save because no table.JPG"). My problem is that a insert hatml page ("CreateMask Html.JPG") show the foregn key as a textbox and not like a combobox. In this file "Table.JPG" you can see my table. I expect to have a ComboBox when there are FK and about this I think that the software should know the relationships between tables and the PK will be hidden.

    Do I need to intervene manually to change the TextBox in ComboBox or can I do it via tool? Obviously it also serves the code to load data from the DB (here I wait for the reply to the previous post if you can use 2 DB).

    Normally, there should be a combobox item. Could you try to define relations between your entities as I explained in my second answer above and see if textboxes become combobox ?

    Other question: is possible to create a Master Detail web form?

    Sorry, it is not supported yet.

    By the way, if you can send a sample MySql database schema to [email protected], it would help us to test your case.

    Thanks,

  • User Avatar
    0
    microgate created

    Hi,

    "I suggest you to move your tables to AspNet Zero database. It will make your development easier for the future. --> ok, but when I import my sql table in new db, the tool change the PK and set it in a new column "id" as show in first question. Is possible to set as PK my original colum (if is not a problem for AspNet Zero)? I can leave your columns "Id" and "TenantId", but if can set my colums as PK, i can recreate the original relation.

    "Don't add migration at first. Define the relations between your entities and add a single migration for all of your entities at once." --> How I have to define this relations? in attached file "EnitiesRelations.JPG" you can see my property from Customer to Address (one to many). I had use System.Collections.Generic.List, but i think i must to use one your list object (I used the same method for DTO classes: CustomerDto and AddresseDto). However in a "InsertDiv.JPG" you can see Address FK ad textbox and not as ComboBox. If i use PowerTool for regenerate this table, i loose my new property (as I expect). Instead a TextBox or ComboBox, is possible to define a control that open a new div for insert a new Addess or something like this?

    "Normally, there should be a combobox item. Could you try to define relations between your entities as I explained in my second answer above and see if textboxes become combobox" --> In CreateOrEditModal.cshtml file, the address object is: input class="form-control" id="Addresse_idAddress" value="@Model.Addresse.idAddress" type="text" name="idAddress" required. By Modifying the relationships between the entities, how could it automatically change to a ComboBox?

    I think there is a bug or something wrong. If I save a new Adress i have one error as you can see in "SaveAddress.JPG". There are two problems: 1) why this error (maybe about FK)? 2) The record was written on the DB... even if the Web page, it returns an error.

    "Sorry, it is not supported yet. to create a Master Detail web form" --> Can I create this page by myself from scratch?

    "if you can send a sample MySql database schema to [email protected], it would help us to test your case" --> Yes i will send a .bak file because the DB is new and is empty. Do you need my original DB?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @microgate

    I got the DB scripts from you but didn't have a chance to try. Have you figured out the problems you are having ?

  • User Avatar
    0
    microgate created

    Hi

    No, i don't know what i have to do. I have always a textbox instead combobox or other list object. I have try with other tables, but is always same..

  • User Avatar
    0
    ismcagdas created
    Support Team

    Could you also share your project with us via email ? We will take a look at it and fix the problem for you.

  • User Avatar
    0
    yekalkan created

    Hi,

    Guid filters should be nullable. This is a bug that we need to fix as soon as possible.

    You need to make Guids nullable (Guid?) in GetAll{EntityName}Input.cs file.