microsoft / microsoft/DacFx

DacFx - only return public types as properties

Open
#399 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

If you have a TSqlObject like a `Column`, you can get the `Length` using:

```csharp
var length = column.GetProperty(Column.Length);
```

Length is an int of the actual length. If we wanted to know something more exotic such as the expression on a calculated column we should do:

```csharp
var expression = column.GetProperty(Column.Expression);
```

*but* SqlScriptProperty is an internal class so we can't use the typed version, instead we need to fall back to getting a `object`:

```csharp
var expression = column.GetProperty(Column.Expression);
```

It happens to be a string but we don't know at compile time what the type is or just always assume it ends up being a string.

We can't force a string as in:

```csharp
var expression = column.GetProperty(Column.Expression);
```

Because we get a cast failure (can't case SqlScriptProperty to string)

Please can you only return public classes when we use TSqlObject.GetProperty.

**If there is somewhere better to raise DacFx issues please say :) **

Contributor guide

Open the contributing guide

Research direction

Start at the TSqlObject.GetProperty API and trace how Column.Length and Column.Expression are resolved, including the internal SqlScriptProperty type. Confirm the intended behavior for public and object-based access, then verify that callers can retrieve supported public types without exposing internal classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.