Is it possible to extract row values from an in memory bacpac

44 views Asked by At

I have a piece of code that extracts db schema and data for specified tables to a bacpac saved in a memory stream using

Microsoft.SqlServer.Dac.DacServices.ExportBacpac(stream, database, tables);

I use the this code to export a database to bacpac (with data for the specified tables), so I know the rows are "somewhere" in the stream.

I am currently using an approach extracting a TSqlModel like this:

var modelLoadOptions = new ModelLoadOptions(DacSchemaModelStorageType.Memory, true);
using TSqlModel model = TSqlModel.LoadFromDacpac(stream, modelLoadOptions);

I can access the individual tables like this:

var tables = model.GetObjects(DacQueryScopes.UserDefined, ModelSchema.Table);

But I simply can't figure out how to access the individual rows / cells and their values.

Most likely TSqlModel.LoadFromDacpac only extracts the schema so this simply isn't possible?

If it isn't possible, is there another approach to extract the cell values from the available bacpac stream or should I just forget all about it?

0

There are 0 answers