LblGenPro 5.7 (5.7.0) RTM
We're using the following stored procedure in a context where each tenant has it's own MSSQL database
using var da = _dbContext.GetNewAdapter(); // see below how it is created
return await da.FetchProjectionAsync<VenueDistanceResultRow>(
RetrievalProcedures.GetVenueDistanceCallAsQuery(maxDistance, latitude, longitude, da), cancellationToken);
}
Actual command created:
Executed Sql Query:
Query: Stored procedure call: [dbo].[VenueDistance](@MaxDistance, @Lat, @Lng)
Parameter: @MaxDistance : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 0,5.
Parameter: @Lat : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 48,1802849.
Parameter: @Lng : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 10,762421700000003.
This query fails unless the current user has a default database set, but which may be the wrong database for the tenant.
Expected command - should include the database [a-indoor]:
Query: Stored procedure call: [a-indoor].[dbo].[VenueDistance](@MaxDistance, @Lat, @Lng)
Parameter: @MaxDistance : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 0,5.
Parameter: @Lat : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 48,1802849.
Parameter: @Lng : Double. Length: 0. Precision: 38. Scale: 0. Direction: Input. Value: 10,762421700000003.
_dbContext.GetNewAdapter() returns the following:
return new DataAccessAdapter(ConnectionString)
{
KeepConnectionOpen = true,
CompatibilityLevel = SqlServerCompatibilityLevel.SqlServer2012,
CommandTimeOut = CommandTimeOut,
CatalogNameOverwrites =
new CatalogNameOverwriteHashtable(new Dictionary<string, string> { { "*", Catalog } })
{
CatalogNameUsageSetting = CatalogNameUsage.ForceName
},
SchemaNameOverwrites =
new SchemaNameOverwriteHashtable(new Dictionary<string, string> { { "*", Schema } })
{
SchemaNameUsageSetting = SchemaNameUsage.ForceName
}
};
Is this a bug or which different method should we use to call the stored procedure which must include the selected database?