As per MSDN,
Managed Code - Code that could be understood and managed by CLR
Unmanaged Code - Code that could not handled by CLR
But I am wondering how do I identify which resource or class is CLR compliant & which Not.
I referred below links
How do we distinguish between managed and unmanaged resources in C#? Is TextFieldParser unmanaged?
public class Customer { //What makes this CLR compliant } public class DbConnectionHandler: IDisposable { //Database Connection & other related stuff //What makes this CLR Non-Compliant }
If I am using EF (LINQ to Entities), it is translated to native SQL. SO all LINQ falls under Unmanaged Code category?
Thanks!
"unmanaged" here is referring to in-process execution of non-CLR code (don't confuse that with "CLR compliant", whatever that might mean); so - EF and LINQ are managed (or mostly managed), but they often talk indirectly to unmanaged dlls (think: C/C++ dlls, etc - nothing to do with the CLR) at some point - for example, many of the ADO.NET providers are really P/Invoke layers to an unmanaged database drivers - or unsafe
code that talks to manually allocated raw memory in the local process (a chunk of memory allocated via Marshal.AllocHGlobal
, for example). Usually these exist in a dual state: there's a managed layer that abstracts and hides the unmanaged layer - so application level code rarely talks to unmanaged code directly.
The fact that native SQL is involved is unrelated, as that isn't "managed" or "unmanaged" - it isn't in-process, so it is a different category altogether.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.