{"id":41,"date":"2009-03-31T14:38:22","date_gmt":"2009-03-31T13:38:22","guid":{"rendered":"http:\/\/www.ms-mueller.ch\/wp\/?p=41"},"modified":"2009-03-31T14:38:22","modified_gmt":"2009-03-31T13:38:22","slug":"scsf-entitymappertranslator-fehler-im-vb-code","status":"publish","type":"post","link":"https:\/\/www.ms-mueller.ch\/?p=41","title":{"rendered":"SCSF: EntityMapperTranslator Fehler im VB Code"},"content":{"rendered":"<p>So heute habe ich ein weinig mit der Smart Client Software Factory gearbeitet.<\/p>\n<p>Als ich nun einen <span class=\"CodePlexPageHeader\">EntityMapperTranslator erstellen wollte hat noch alles geklappt nur leider wollte er diesen nicht finden als ich Ihn aufgerufen habe.<\/span><br \/>\nEin Eintrag im Forum gab dann aufschluss \u00fcber das Problem:<\/p>\n<p><a title=\"http:\/\/www.codeplex.com\/smartclient\/Thread\/View.aspx?ThreadId=10938\" href=\"http:\/\/www.codeplex.com\/smartclient\/Thread\/View.aspx?ThreadId=10938\">http:\/\/www.codeplex.com\/smartclient\/Thread\/View.aspx?ThreadId=10938<\/a><\/p>\n<p>Die Basisdateien enthalten im VB Code ein paar kleine Fehler:<\/p>\n<p>EntityMapperTranslator.vb<\/p>\n<pre style=\"border: 0.1em dashed #3e62a6; padding: 0.5em; overflow: auto; background-color: #ececec; font-family: Consolas,Courier New,Courier,Monospace; font-size: 1em; margin-top: 0pt; height: auto;\">    Public MustInherit Class EntityMapperTranslator(Of TBusinessEntity, TServiceEntity)\n        Inherits BaseTranslator\n\n        Public Overloads Overrides Function CanTranslate(ByVal targetType As System.Type, ByVal sourceType As System.Type) As Boolean\n\t\t\tReturn (<span style=\"color: #ff0000;\">targetType Is GetType(TBusinessEntity)<\/span> AndAlso <span style=\"color: #ff0000;\">sourceType Is GetType(TServiceEntity))<\/span> OrElse _\n\t\t\t<span style=\"color: #ff0000;\">(targetType Is GetType(TServiceEntity)<\/span> AndAlso<span style=\"color: #ff0000;\"> sourceType Is GetType(TBusinessEntity)<\/span>)\n\t\tEnd Function\n\n        Public Overloads Overrides Function Translate(ByVal service As [Interface].Services.IEntityTranslatorService, ByVal targetType As System.Type, ByVal source As Object) As Object\n\t\t\tIf <span style=\"color: #ff0000;\">targetType Is GetType(TBusinessEntity)<\/span> Then\n\t\t\t\tReturn ServiceToBusiness(service, CType(source, TServiceEntity))\n\t\t\tEnd If\n\n\t\t\tIf<span style=\"color: #ff0000;\"> targetType Is GetType(TServiceEntity)<\/span> Then\n\t\t\t\tReturn BusinessToService(service, CType(source, TBusinessEntity))\n\t\t\tEnd If\n\n            Throw New EntityTranslatorException()\n        End Function\n\n        Protected MustOverride Function BusinessToService(ByVal service As IEntityTranslatorService, ByVal value As TBusinessEntity) As TServiceEntity\n\n        Protected MustOverride Function ServiceToBusiness(ByVal service As IEntityTranslatorService, ByVal value As TServiceEntity) As TBusinessEntity\n\n    End Class<\/pre>\n<p>Bei VB kann man leider nicht mit dem TypeOf Operator arbeiten um diesen Vergleich auszuf\u00fchren.<\/p>\n<p>EntityMapperTranslaterService.vb<\/p>\n<pre style=\"border: 0.1em dashed #3e62a6; padding: 0.5em; overflow: auto; background-color: #ececec; font-family: Consolas,Courier New,Courier,Monospace; font-size: 1em; margin-top: 0pt; height: auto;\">        Public Function CanTranslate(ByVal targetType As System.Type, ByVal sourceType As System.Type) As Boolean Implements [Interface].Services.IEntityTranslatorService.CanTranslate\n            If targetType Is Nothing Then\n                Throw New ArgumentNullException(\"targetType\")\n            End If\n            If sourceType Is Nothing Then\n                Throw New ArgumentNullException(\"sourceType\")\n            End If\n\n\t\t\tReturn IsArrayConversionPossible(targetType, sourceType) OrElse FindTranslator(targetType, sourceType) <span style=\"color: #ff0000;\">IsNot <\/span>Nothing\n        End Function<\/pre>\n<p>Hier muss es isNot anstatt Is heissen.<\/p>\n<p>So mal weiter \u00fcben. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So heute habe ich ein weinig mit der Smart Client Software Factory gearbeitet. Als ich nun einen EntityMapperTranslator erstellen wollte hat noch alles geklappt nur leider wollte er diesen nicht finden als ich Ihn aufgerufen habe. Ein Eintrag im Forum gab dann aufschluss \u00fcber das Problem: http:\/\/www.codeplex.com\/smartclient\/Thread\/View.aspx?ThreadId=10938 Die Basisdateien enthalten im VB Code ein paar [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[12,18],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-visual-studio","tag-scsf","tag-vs"],"_links":{"self":[{"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ms-mueller.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}