{"id":177,"date":"2008-10-28T02:18:15","date_gmt":"2008-10-28T06:18:15","guid":{"rendered":"http:\/\/www.cchsu.com\/arthur\/?p=177"},"modified":"2008-11-01T02:59:40","modified_gmt":"2008-11-01T06:59:40","slug":"pdc-day-1-net-type-system-advancements","status":"publish","type":"post","link":"http:\/\/www.cchsu.com\/arthur\/2008\/10\/28\/177\/","title":{"rendered":"PDC 2008: Day 1, .Net Type System Advancements"},"content":{"rendered":"<p>\u5fae\u8edf\u6253\u7b97\u5728 .Net CLR 4.0 \u4e2d\u6539\u9032\u5b83\u7684\u578b\u5225\u7cfb\u7d71 (type system)\u3002\u9019\u500b\u6539\u9032\u7684\u4e3b\u8981\u52d5\u6a5f\u6709\u5169\u500b\uff0c\u4e00\u662f\u73fe\u884c\u7684 .Net \u7a0b\u5f0f\u82e5\u662f\u7528\u5230\u4e86 interop assembly\uff0c\u5728\u5b89\u88dd\u7684\u6642\u5019\uff0c\u9019\u4e9b interop assembly \u7684\u9ad4\u7a4d\u901a\u5e38\u8981\u6bd4\u4f60\u5beb\u7684\u7a0b\u5f0f\u5927\u5f88\u591a\u3002\u6bd4\u65b9\u8aaa\uff0c\u5728\u7a0b\u5f0f\u4e2d\u7528\u5230\u4e86 Excel 2007 interop \u7684\u8a71\uff0c\u5c31\u5fc5\u9808\u52a0\u88dd 6.7MB \u7684 Office 2007 PIA redist\uff0c\u9664\u4e86\u5b89\u88dd\u7528\u7684 package \u8b8a\u5927\u4e4b\u5916\uff0c\u7a0b\u5f0f\u57f7\u884c\u6642\u6d6a\u8cbb\u7684 working set \u4e5f\u8b8a\u591a (\u4f60\u7e3d\u4e0d\u6703\u7528\u5230 interop assembly \u4e2d\u7684\u6bcf\u4e00\u6a23\u529f\u80fd\u5427?)\u3002\u6b64\u5916\uff0c\u5c0d\u65bc managed to managed assembly\uff0c\u76ee\u524d\u7684\u505a\u6cd5\u662f\u9032\u884c\u975e\u5e38\u56b4\u683c\u7684\u7248\u672c\u6aa2\u67e5\uff0c\u82e5\u7248\u672c\u4e0d\u5408\u5c31\u76f4\u63a5\u8e22\u6389\u3002\u9019\u96d6\u7136\u89e3\u6c7a\u4e86 DLL hell \u7684\u554f\u984c\uff0c\u4f46\u537b\u9020\u6210\u66f4\u591a\u554f\u984c: multi-target complexity \u4ee5\u53ca deployment complexity\u3002<\/p>\n<p>multi-target \u9019\u500b\u554f\u984c\u88ab\u553e\u68c4\u5f88\u4e45\uff0c\u9023\u5fae\u8edf\u81ea\u5df1\u7684\u5e2b\u7a0b\u5de5\u4e5f\u5f88\u4e0d\u723d\uff0c\u56e0\u6b64 CLR 4.0 \u5c31\u63a8\u51fa\u5169\u500b\u91cd\u5927\u7684\u6539\u9032: type embedding \u8207 type equivalance\u3002Type embedding \u4e3b\u8981\u662f\u8981\u8655\u7406 interop assembly \u7684\u554f\u984c\u3002\u6bd4\u5982\u8aaa\uff0c\u6211\u5011\u7684\u7a0b\u5f0f\u4e2d\u7528\u5230 Excel interop\uff0c\u65b0\u7248\u7684 C# compiler \u5728\u7de8\u8b6f\u6642\u53ef\u4ee5\u76f4\u63a5\u532f\u5165\u8a72 interop assembly \u7684 meta data\uff0c\u800c\u4e14\u6703\u628a\u6c92\u6709\u7528\u5230\u7684 vtable slot \u76f4\u63a5\u8df3\u904e\uff0c\u56e0\u6b64\u5c31\u4e0d\u9700\u8981 interop assembly \u4e5f\u53ef\u4ee5\u77e5\u9053 native COM object \u7684 GUID \u4ee5\u53ca vtable offset\u3002\u5728\u57f7\u884c\u7684\u6642\u5019\uff0cCLR \u6703\u5075\u6e2c\u9019\u500b assembly \u662f\u5426 embed partial interop information\uff0c\u82e5\u662f\u7684\u8a71\uff0c\u5b83\u6703\u6539\u8b8a\u5177\u73fe\u5316 COM object \u7684\u65b9\u5f0f\uff0c\u7528\u65b0\u7684\u65b9\u6cd5\u53bb\u627e\u5230\u5c0d\u61c9\u7684 factory \u4e26\u5177\u73fe\u5316\u3002<\/p>\n<p>Type equivalence \u5247\u662f\u6539\u8b8a CLR \u5c0d\u5f85 interface casting \u7684\u65b9\u5f0f\uff0c\u5728 CLR 4.0 \u4e2d\uff0c\u82e5\u5169\u500b interface \u6709\u76f8\u540c\u7684 guid\uff0c\u5247 CLR \u6703\u5c07\u9019\u5169\u500b interface \u8996\u70ba castable\u3002\u5728\u57f7\u884c\u6642\uff0c\u82e5 vtable offset \u548c function signature \u4e5f\u76f8\u540c\uff0c\u5c31\u5141\u8a31\u547c\u53eb\u9019\u500b\u51fd\u6578 (\u7c21\u8a00\u4e4b\uff0cCLR \u4e0d\u518d\u8a08\u8f03 assembly version)\u3002\u82e5\u662f\u627e\u4e0d\u5230\u8a72\u51fd\u6578\uff0c\u6216\u662f signature \u4e0d\u5408\uff0c\u8a72\u7269\u4ef6\u4ecd\u6703\u88ab\u5177\u73fe\u5316\uff0c\u4f46\u7cfb\u7d71\u6703\u6254\u51fa System.MethodMissingException\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fae\u8edf\u6253\u7b97\u5728 .Net CLR 4.0 \u4e2d\u6539\u9032\u5b83\u7684\u578b\u5225\u7cfb\u7d71 (type system)\u3002\u9019\u500b\u6539\u9032\u7684\u4e3b\u8981\u52d5\u6a5f\u6709\u5169\u500b\uff0c\u4e00\u662f\u73fe\u884c\u7684 .Net \u7a0b\u5f0f\u82e5\u662f\u7528\u5230\u4e86 interop assembly\uff0c\u5728\u5b89\u88dd\u7684\u6642\u5019\uff0c\u9019\u4e9b interop assembly \u7684\u9ad4\u7a4d\u901a\u5e38\u8981\u6bd4\u4f60\u5beb\u7684\u7a0b\u5f0f\u5927\u5f88\u591a\u3002\u6bd4\u65b9\u8aaa\uff0c\u5728\u7a0b\u5f0f\u4e2d\u7528\u5230\u4e86 Excel 2007 interop \u7684\u8a71\uff0c\u5c31\u5fc5\u9808\u52a0\u88dd 6.7MB \u7684 Office 2007 PIA redist\uff0c\u9664\u4e86\u5b89\u88dd\u7528\u7684 package \u8b8a\u5927\u4e4b\u5916\uff0c\u7a0b\u5f0f\u57f7\u884c\u6642\u6d6a\u8cbb\u7684 working set \u4e5f\u8b8a\u591a (\u4f60\u7e3d\u4e0d\u6703\u7528\u5230 interop assembly \u4e2d\u7684\u6bcf\u4e00\u6a23\u529f\u80fd\u5427?)\u3002\u6b64\u5916\uff0c\u5c0d\u65bc managed to managed assembly\uff0c\u76ee\u524d\u7684\u505a\u6cd5\u662f\u9032\u884c\u975e\u5e38\u56b4\u683c\u7684\u7248\u672c\u6aa2\u67e5\uff0c\u82e5\u7248\u672c\u4e0d\u5408\u5c31\u76f4\u63a5\u8e22\u6389\u3002\u9019\u96d6\u7136\u89e3\u6c7a\u4e86 DLL hell \u7684\u554f\u984c\uff0c\u4f46\u537b\u9020\u6210\u66f4\u591a\u554f\u984c: multi-target complexity \u4ee5\u53ca deployment complexity\u3002 multi-target \u9019\u500b\u554f\u984c\u88ab\u553e\u68c4\u5f88\u4e45\uff0c\u9023\u5fae\u8edf\u81ea\u5df1\u7684\u5e2b\u7a0b\u5de5\u4e5f\u5f88\u4e0d\u723d\uff0c\u56e0\u6b64 CLR 4.0 \u5c31\u63a8\u51fa\u5169\u500b\u91cd\u5927\u7684\u6539\u9032: type embedding \u8207 type equivalance\u3002Type [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,2,7],"tags":[],"_links":{"self":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/177"}],"collection":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":2,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":203,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/177\/revisions\/203"}],"wp:attachment":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}