How to do an insert and update for an object with a navigation property using Dapper.Rainbow (or optionally using Dapper
By : Dmitriy G
Date : March 29 2020, 07:55 AM
will help you Not With Dapper.Rainbow This is not possible with Dapper.Rainbow in its current form but my pull request in github make this possible. code :
public class Product {
public int Id {get;set;}
public string Name {get;set;}
[Write(false)] // tell Dapper to exclude this field from the sql
public ProductCategory Category {get;set;}
public int CategoryId {get;set;}
}
public interface IProduct {
int Id {get;set;}
string Name {get;set;}
ProductCategory Category {get;set;}
int Category {get;set;}
}
// and implement it on my Product class
public class Product : IProduct {
public int Id {get;set;}
public string Name {get;set;}
[Write(false)]
public ProductCategory Category {get;set;}
int Category {get;set;}
}
var product = connection.Get<IProduct>(id);
public interface IProduct {
// I will not discuss here what this attribute does
// as this is documented already in the github source.
// Just take note that this is needed,
// both here and in the implementing class.
[Key]
int Id {get;set;}
string Name {get;set;}
[Write(false)]
ProductCategory Category {get;set;}
int Category {get;set;}
}
// and implement it on my Product class
public class Product : IProduct {
[Key]
public int Id {get;set;}
public string Name {get;set;}
[Write(false)]
public ProductCategory Category {get;set;}
int Category {get;set;}
}
|
Dapper complex mapping Dapper.Extensions Dapper.FluentMap
By : user3052407
Date : March 29 2020, 07:55 AM
wish helps you I have a bit of a problem with my code and getting dapper to play nicely with it. , Have you tried sth like that: code :
Feed feed = null;
var sql =
@"
SELECT * FROM Feeds WHERE FeedId= @FeedId
SELECT InboundProperties_ExternalRef as ExternalRef, InboundProperties_ExternalRefPrevious as ExternalRefPrevious FROM Feeds as InboundProperties WHERE FeedId= @FeedId
SELECT * FROM FeedFilterParameters WHERE FeedId = @FeedId
SELECT * FROM TeamFeeds WHERE FeedId = @FeedId";
using (var multi = DbConnection.QueryMultiple(sql, new { FeedId = feedId }))
{
feed = multi.Read<Feed>().Single();
feed.InboundProperties = multi.Read<InboundProperties>().Single();
feed.Parameters = multi.Read<FeedFilterParameter>().ToList();
feed.TeamFeeds = multi.Read<TeamFeed>().ToList();
}
return feed;
|
Dapper is converting my dates into 01-Jan-01 and I cannot see why?
By : user2210677
Date : March 29 2020, 07:55 AM
may help you . @John has it correct in his comment. The name of the property (here CreationDateTime) generally must match the name of the column (here CreationTime). Having that said, it is not really the name of the table column, but the name of the result column, so you could do something like this: code :
SELECT CreationTime as CreationDateTime, ...
|
How to select dates after three dates from current date using ajax control kit
By : HeroicNonsense
Date : March 29 2020, 07:55 AM
this will help How can i disable all future dates after three days from current date (Today) in AJAX control kit , To select date which is greater than 3 days: code :
var date = new Date();
date.setDate(date.getDate() + 3);
if(selected_date > date){
// code here
}
<script type="text/javascript">
function checkProjectEndDate(sender, args) {
var future_date = new Date();
future_date.setDate(future_date.getDate() + 2);
if (sender._selectedDate > future_date) {
alert("You can not select a future date than today!");
sender._selectedDate = new Date();
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script>
|
Formatting the dates to desired format return invalid dates in python. How to control it?
By : Mike Rief
Date : March 29 2020, 07:55 AM
|