Retrofit 2.0 define variable type - retrofit2

My team using Retrofit 2.0 (I'm not android guy), when I select ID from mysql, it always returns string type, but my project requires to return by Integer. Anyone know how to convert type with Retrofit 2.0.
Thank you so much!

Related

Azure Functions .Net 5: Is it possible to implement POCO binding somehow?

When moving my functions to .net5 I faced the fact that POCO binding that worked fine with 3.1 is not applicable with .net 5 anymore for some reason. They say it will be implemented at some point maybe, but for the certain reasons I need it now. Tried to find some hacky way to implement this, but failed. The best thought I had was to implement explicit operator in my DTO object which will cast HttpRequestData to it's type, but the problem is that HttpRequestData is an abstract type, and it's concrete implementation type is internal. After that I tried to cast the input parameter to HttpRequestData in middleware with reflection, but parameters are stored in IReadOnlyDictionary which is immutable. So I ran out of ideas now. Maybe someone found workaround to this and can kindly share, would be much appreciated.
I suppose you're using the "dotnet-isolated" mode (only way to run on .NET 5).
I'm trying to find a more elegant solution to this as well.
Meanwhile, what I did was to deserialize the data myself, inside the function.
var body = await new StreamReader(request.Body).ReadToEndAsync();
var myobject = JsonSerializer.Deserialize<MyPocoClass>(json);
I would really prefer if the runtime did it by itself, but I couln't find a way yet. I read somewhere that it is possible to create our own binding code, but I haven't tried it.
I noticed that I could bind to individual properties of the json payload, but not to an object...
I hope this arrives in Azure Functions v4 + .NET6, since it is right around the corner.

Cannot compile xamarin.ios binding project

I am creating a binding project for Xamarin.ios. I have done ApiDefinition.cs and Structs.cs. When I rebuild my binding project I am getting fillowing two errors in visual studio
Error CS0308 The non-generic type 'NSObject' cannot be used with type arguments
Error CS0111 Type 'LSMAHandlerPincode' already defines a member called
'SendInvitationForUsecase' with the same parameter
For the 2nd issue I can see two methods with same name and the same types are there. But I don't know how to resolve that issue since I need both methods defined in the objective-c framework.
These are my duplicate methods
[Abstract]
[Export("sendInvitationForUsecase:toEmail:withReference:andNotify:")]
void SendInvitationForUsecase(LSMAUsecase usecase, string email, [NullAllowed] string reference, [NullAllowed] Action<LSMAPincodeStatus_t, NSString> block);
// #required -(void)createInvitationForUsecase:(NSObject<LSMAUsecase> * _Nonnull)usecase withReference:(NSString * _Nullable)reference andNotify:(void (^ _Nullable)(LSMAPincodeStatus_t, NSString * _Nullable))block;
[Abstract]
[Export("createInvitationForUsecase:withReference:andNotify:")]
void CreateInvitationForUsecase(LSMAUsecase usecase, [NullAllowed] string reference, [NullAllowed] Action<LSMAPincodeStatus_t, NSString> block);
Does anybody know how can I solve these 2 issues? Please help me.
Thanks
UPDATE
Please find the link for ApiDefinition.cs and Structs.cs
https://www.dropbox.com/s/aa22vg9r7mme636/Files.rar?dl=0
Link for the framework
https://github.com/sightcall/iOS-UniversalSDK

Groovy version downgrade 2.2.1

We have been building our application using groovy 2.3.6. Now because of some platform level issues we are advised to downgrade our groovy version to 2.2.1. I am facing no. of issues regarding this downgrade.
groovy is not able to infer the type of it variable in ver 2.2.1 so if i have code something like this
names.any { sliceName.endsWith(it) }
it gives me exception
[Static type checking] - Cannot find matching method java.lang.String#endsWith(java.lang.Object)
Secondly all the default method that i had used in collections no longer seem to exist
positions.any { it.primary }
groovy is unable to find the any method on list.
One way would be turn off static type checking, which will expose the code to a lot more runtime errors.
Is there any way to resolve these errors, without turning off static type checking. Also are these features only added in groovy 2.3.6 like default groovy methods and type inference for it variable
If you go back to an old version, old bugs will bite you.
Try giving the static compiler more of a hint
names.any { String it -> sliceName.endsWith(it) }

Catel ServiceLocatorRegistration attribute get compile error message

I try to create automatically registering with Catel framework,
[ServiceLocatorRegistration(typeof(ISalesOrderListViewModel))]
public class SalesOrderListViewModel : ISalesOrderListViewModel
{
}
But i got this error when compile this code.
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
Does Catel ServiceLocatorRegistration attribute need something I don't know?
help!!
Finally I find under net framework 4.5, this attribute works fine, but when I try to run this under net framework 4.0, this attribute doesn't work, which meaning I get compile error.
Mr. Geert, I don't know I should submit this to issue track or you may don't support this under net framework 4.0.

Subsonic 3.0 and SqlHierachyID

I am having trouble with Subsonic 3.0 generating an object for a table which contains the new HeirachyID datatype. From what I have found, there is no corrosponding .Net type, and subsonic doesn't seem to know how to handle the hierachyid data.
Error that is thrown:
Object of type 'Microsoft.SqlServer.Types.SqlHierarchyId' cannot be converted to type 'System.String'.
Code:
foreach (MyDB.DataAccess.ThingCategory tc in DataAccess.ThingCategory.Find(x => x.fk_Thing.Equals(thingId)))
{
sb.AppendFormat("<{0}>{1}</{0}>", wrapTag, tc.Categories.ToList<DataAccess.Category>()[0].Name);
}
tc.Categories.ToList() generates the error
Alternatively, I tried to get around this by writing a sproc to return the hierachyid column as a string, and noticed SubSonic 3.0 sprocs are not strongly-typed. or am I doing something wrong?
Sprocs can be strongly-typed by calling ExecuteTypedList()
I would create an issue on the Github tracker to either add support for the type (someone will have to contribute this since I don't think it's a high priority) or to gracefully handle it when they exist.

Resources