'How to realize what is the datatype of a column in migration file?
I have a migration file that ALTERING a column datatype, I want to know what is the datatype of the column before ALTERING?
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey("FK_HomeAccessControl_Child_Individual", "HomeAccessControl");
migrationBuilder.DropForeignKey("FK_HomeAccessControl_Parent_Individual", "HomeAccessControl");
Console.WriteLine(HomeAccessControl.Child_Individual_ID.DataType);
//Here I want to know what is the "Parent_Individual_ID" datatype
migrationBuilder.AlterColumn<long>("Parent_Individual_ID", "HomeAccessControl");
migrationBuilder.AlterColumn<long>("Child_Individual_ID", "HomeAccessControl");
migrationBuilder.Sql(@"UPDATE HomeAccessControl SET Parent_Individual_ID=AbpUsers.Id
FROM HomeAccessControl INNER JOIN AbpUsers
ON HomeAccessControl.Parent_Individual_ID=AbpUsers.[Individual_ID_Old]");
migrationBuilder.Sql(@"UPDATE HomeAccessControl SET [Child_Individual_ID]=AbpUsers.Id
FROM HomeAccessControl INNER JOIN AbpUsers
ON HomeAccessControl.[Child_Individual_ID]=AbpUsers.[Individual_ID_Old]");
migrationBuilder.AddForeignKey("FK_HomeAccessControl_Child_Individual",
"HomeAccessControl", "Child_Individual_ID", "AbpUsers", principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey("FK_HomeAccessControl_Parent_Individual",
"HomeAccessControl", "Parent_Individual_ID", "AbpUsers", principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
How I can realize the datatype of the column before ALTERING command? Thanks
Solution 1:[1]
We have tested this in our local environment, Below statements are based on our analysis.
While creating the linked service through AzureCLI cmdlet using az data factory linked-service create ,you need to pass the json file to the --properties flag .
az datafactory linked-service create --factory-name
--linked-service-name
--properties
--resource-group
[--if-match]
- If you declare the
properties{}list on top of thetypeproperties{}in your json file then while creating the linked service to the data factory it will fail with the error that you have shared as shown in the below
- You Need pass only
typePropertiesin json file to create a linked service with the data factory as shown in the below.
In the below example ,we are trying to create a keyvault linked service with our existing ADF.
Here is our keyvault.json file which has type properties.
{
"type": "AzureKeyVault",
"typeProperties":{
"baseUrl": "<keyvault>"
},
"annotations":[<requiredannotations],
"description":"<requireddescription>",
"parameters": {
"test":{
"type":"String",
"defaultValue":"test"
}
}
}
Here is the sample output for reference :
You can use the above keyvault.json file as reference & make the changes as per your requirement.
You can also refer this documentation, for more information about what all the properties that we can pass to AzurekeyVaultLinkedService & there respective datatypes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VenkateshDodda-MSFT |


