How to mark a .net assembly as safe?

后端 未结 4 646
名媛妹妹
名媛妹妹 2021-02-05 09:26

How do i mark as assembly as \"safe\"?

Alternatively, how do i have Visual Studio tell me when something in my assembly is not \"safe\"?


Sometimes you cann

4条回答
  •  盖世英雄少女心
    2021-02-05 09:53

    • Reading from this, the "Safe" for SQL Server is a:

    SAFE is the most restrictive permission set. Code executed by an assembly with SAFE permissions cannot access external system resources such as files, the network, environment variables, or the registry

    so its about code execution permission set inside SQL Server code domain

    • Unsafe flag from VS has nothing to do, basically, with code execution security, but enables non managed code execution. So this about non managed code integration into managed code base

    • CLS Compilant attribute as defined here is about defining the code of the assembly marked with that attribute like a code that follows CSL (Common Language Specification) guideline. So this about compilation and code architecture.

    How do i mark as assembly as "safe"?

    It defined in the first link in this answer and has relation with SQL Server integration.

    How does SQL know that as assembly is "not safe"?

    Considering description provided: "Creates a managed application module that contains class metadata and managed code as an object in an instance of SQL Server", SQL Server relays on metadata, that in some fields provides an information about the fact if it is "safe" or not.

提交回复
热议问题