Display custom types in entity structure

We would like to use a custom type and display this type separately in the Entity Framework.

The type is defined in SQL Server as:

CREATE TYPE EncryptedSSN FROM VARCHAR(MAX) NULL ; 

And this type is designed to store encrypted data, so we want the column type to be displayed when used in code. Instead of type EncryptedSSN type Varchar(max) .

We use handlers for columns based on the data type. Since the Entity Framework does not support encrypted columns, we would like to encrypt certain fields and quietly handle encryption for the rest of the code. There are other columns defined as varchar (max), so they cannot be filtered by these criteria.

We understand that the Entity Framework does not support user-defined types in the CLR. If this is not the case, tell me otherwise.

How can we get the EncryptedSSN type to display in the model browser?

+6
source share
1 answer

This is rude, but you can make a varchar(some_number_which_is_unlikely_to_be_used_for_another_purpose) column varchar(some_number_which_is_unlikely_to_be_used_for_another_purpose)

-1
source

Source: https://habr.com/ru/post/947887/


All Articles