E1.22 Php Symfony Security Step 3: Generate EF entities and context (Wpf, Xamarin, Angular SPA, Reactjs SPA) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

Note 1:

To get Wizards ready we need EF entities and context. We have already discussed that EF classes is not a coding tool. They are part of a modeling tool.

Note 2:

For now we only have "LitDbContext". We will use it to generate security entities and context.

Create folders for EF entities and context

  • With Visual Studion under projects which are used for entities and contexts we create new folders.
    • In our solution we use Dm01Entity-project for EF entities
      • "AspNetForPhp" will be the name for out temporary classes
    • In our solution we use Dm02Context-project for db-contexts
      • "AspNetForPhp" will be the name for out temporary classes

picture

Generate Entities

  • With Visual Studion right click "AspNetForPhp"-folder of the Dm01Entity-project and run #4 Wpf Forms Wizard
  • On the first page click "Next"-button

picture

  • On the second page select "LitDbContext" click "Next"-button

picture

  • On the third page select "==Context==" click "Next"-button

picture

  • On the fourth page select "==Context==" click "Next"-button

picture

  • On the fifth page click "Batch"-button

picture

  • In the dialog select "00140-AspNetEntities.json" and click "start"-button

picture

Generate dbContext

  • With Visual Studion right click "AspNetForPhp"-folder of the Dm01Entity-project and run #4 Wpf Forms Wizard reppeat the steps above and run "00150-AspNetDbContextPhpDev.json"-batch

  • Here is a result

picture

(00140-AspNetEntities.json vs. 00140-AspNetEntitiesProd.json) and (00150-AspNetDbContextPhpDev.json vs. 00160-AspNetDbContextPhpProd.json)

00140-AspNetEntities.json batch script generates aspnetusermask-entity. This is just a helper class for which no database table should be created. aspnetusermask plays important role as a modeling tool and nothing more. After defining ModelViews for the entities and dbcontext generated by the (00140-AspNetEntities.json + 00150-AspNetDbContextPhpDev.json)-pair you can remove these callses from the project. It is assumed that tables on the SQL server will be created by php tools. The data in these tables will be accessed by php controllers.

But, if you are going to create tables on SQL-server using EntityFramework you should regenerate classes with a (00140-AspNetEntitiesProd.json + 00160-AspNetDbContextPhpProd.json)-pair. Again, it should be done only after defining ModelViews for the classes generated by a (00140-AspNetEntities.json + 00150-AspNetDbContextPhpDev.json)-pair of batch scrripts.