Skip to content

Commit

Permalink
[SQL] Ne pas générer de script d'insert pour le classes non persistées
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Dec 14, 2023
1 parent fde666f commit 0830190
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void GenerateListInitScript(IEnumerable<Class> classes, IEnumerable<Class
var orderList = CoreUtils.Sort(classes.OrderBy(c => c.SqlName), c => c.Properties
.OfType<AssociationProperty>()
.Select(a => a.Association)
.Where(a => a != c && a.Values.Any()));
.Where(a => a != c && a.Values.Any() && a.IsPersistent));

foreach (var classe in orderList)
{
Expand Down
4 changes: 2 additions & 2 deletions TopModel.Generator.Sql/Procedural/ProceduralSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private AbstractSchemaGenerator SchemaGenerator

protected override void HandleFiles(IEnumerable<ModelFile> files)
{
var classes = Classes.ToList();
var classes = Classes.Where(c => c.IsPersistent).ToList();

var manyToManyProperties = Classes.SelectMany(cl => cl.Properties).Where(p => p is AssociationProperty ap && ap.Type == AssociationType.ManyToMany).Select(p => (AssociationProperty)p);
foreach (var ap in manyToManyProperties)
Expand Down Expand Up @@ -95,7 +95,7 @@ protected override void HandleFiles(IEnumerable<ModelFile> files)

private void GenerateListInitScript()
{
var classes = Classes.Where(c => c.Values.Any());
var classes = Classes.Where(c => c.IsPersistent).Where(c => c.Values.Any());

if (classes.Any())
{
Expand Down

0 comments on commit 0830190

Please sign in to comment.