使用Value Injector在源中注入目标时在VB.net中获取异常

时间:2015-12-16 05:25:14

标签: .net vb.net mapper valueinjecter

我得到了这个例外。 "找不到类型ApplicationObj_B上的公开成员 Protected Overrides Function SetValue(c As ConventionInfo) As Object If c.SourceProp.Type.IsValueType OrElse c.SourceProp.Type = GetType(String) OrElse c.TargetProp.Type.IsValueType OrElse c.TargetProp.Type = GetType(String) Then Return c.SourceProp.Value End If If c.SourceProp.Type.IsArray Then Dim arr = TryCast(c.SourceProp.Value, Array) If arr IsNot Nothing Then Dim clone = TryCast(Activator.CreateInstance(c.TargetProp.Type, arr.Length), Array) For index As Integer = 0 To arr.Length - 1 Dim a = arr.GetValue(index) If a.[GetType]().IsValueType OrElse TypeOf a Is String Then Continue For End If If clone IsNot Nothing Then clone.SetValue(Activator.CreateInstance(c.TargetProp.Type.GetElementType()).InjectFrom(Of CloneInjection)(a), index) End If Next Return clone End If End If Return Activator.CreateInstance(c.TargetProp.Type).InjectFrom(Of CloneInjection)(c.SourceProp.Value) End Function 。"

我找出了原因。这是因为,我正在检查源属性类型是仅值或数组。但是,我的source属性类型是一个在其中包含属性的对象。如何编写thrid条件并在该对象中注入这些属性的值?

我正在尝试将一个对象及其子对象注入目标对象和子对象。它基本上属性。请帮帮我

它在最终的Create Activator实例行中抛出异常。

when you find the current location of your phone first you find out the latitude and longitude.So First,Add the plugin your project 
1.cordova plugin add cordova-plugin-geolocation

2.module.controller('GeoCtrl', function($cordovaGeolocation,$http) {

  var posOptions = {timeout: 10000, enableHighAccuracy: false};
  $cordovaGeolocation
    .getCurrentPosition(posOptions)
    .then(function (position) {
      var lat  = position.coords.latitude //here you get latitude
      var long = position.coords.longitude //here you get the longitude
  $http.get('http://maps.googleapis.com/maps/api/geocode/json?latlng='+lat+','+long+'&sensor=true').then(function(data){      $rootScope.CurrentLocation=data.data.results[0].formatted_address;//you get the current location here


        }, function(err) {
          // error
        });
    }, function(err) {
      // error
    });

}):

0 个答案:

没有答案