Error after Infer Database

Hello,

after Infer Database I get error calling database methods - I changed nothing...

public async Task<IQueryable<PDBIntern.Models.PDB.VPfuscheraktJahre>> GetVPfuscheraktJahres(Query query = null)
{
var items = Context.VPfuscheraktJahres.AsQueryable();

        if (query != null)
        {
            if (!string.IsNullOrEmpty(query.Expand))
            {
                var propertiesToExpand = query.Expand.Split(',');
                foreach(var p in propertiesToExpand)
                {
                    items = items.Include(p.Trim());
                }
            }

            if (!string.IsNullOrEmpty(query.Filter))
            {
                if (query.FilterParameters != null)
                {
                    items = items.Where(query.Filter, query.FilterParameters);
                }
                else
                {
                    items = items.Where(query.Filter);
                }
            }

            if (!string.IsNullOrEmpty(query.OrderBy))
            {
                items = items.OrderBy(query.OrderBy);
            }

            if (query.Skip.HasValue)
            {
                items = items.Skip(query.Skip.Value);
            }

            if (query.Top.HasValue)
            {
                items = items.Take(query.Top.Value);
            }
        }

        OnVPfuscheraktJahresRead(ref items);

        return await Task.FromResult(items);
    }

robert

We don't know what this error means and we will need more information how to reproduce it.

I found it - you have added [Column("")] into class where Stored Procedure are used - this is not allowed

public partial class MergePfuscher
    {
        [Column("")]
        public int __ { get; set; }

    }

Please send us your stored procedure definition as SQL script.

ALTER PROCEDURE [dbo].[MERGE_Pfuscher]
(
@Pfuscher_ID INT,
@Pfuscher_IDAlt INT
)
AS
BEGIN

ALTER TABLE dbo.PfuscherbeziehungAkt DISABLE TRIGGER TRI_PfuscherbeziehungAkt
ALTER TABLE dbo.PfuscherbeziehungAktFachgruppe DISABLE TRIGGER TRI_PfuscherbeziehungAktFachgruppe

    UPDATE  PfuscherbeziehungAkt
    SET     Pfuscher_ID = @Pfuscher_ID
    WHERE   Pfuscher_ID = @Pfuscher_IDAlt
    
    DELETE Pfuscher
    WHERE  Pfuscher_ID = @Pfuscher_IDAlt

ALTER TABLE dbo.PfuscherbeziehungAkt ENABLE TRIGGER TRI_PfuscherbeziehungAkt
ALTER TABLE dbo.PfuscherbeziehungAktFachgruppe ENABLE TRIGGER TRI_PfuscherbeziehungAktFachgruppe

END

is there also possible to make such a pots as private?
there are informations which should not be possible to all users!

If you need to send us something private you can send it at info@radzen.com.

UPDATE: Unfortunately I was not able to replicate your case due to missing database objects from your procedure code. If I remove the body of the procedure, the code that will be generated is just the service method with no additional classes in models:




Use an UPDATE statement in the Stored Procedure then the problem exists

robert

I've updated the procedure code as follows however nothing changed:


tried also

same result

Please send us your complete database schema at info@radzen.com to try to replicate the issue.

I cannot send you the complete schema - i will try to find out what causes this - need some time for that and will come back to you