This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void BulkInsertNpgsql<T>(this IDbConnection dbConn, IEnumerable<T> list, IEnumerable<string> insertFields = null) | |
{ | |
if (list == null) return; | |
if (list.Count() < 1) return; | |
var objWithAttributes = list.FirstOrDefault(); | |
var modelDef = OrmLiteConfig.GetModelDefinition(objWithAttributes.GetType()); | |
if (insertFields == null) insertFields = new List<string>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/question" method="post"> | |
<ul> | |
<li> | |
<input type="text" name="Name" value="Question Name" /> | |
<input type="text" name="Id" value="1" /> | |
</li> | |
<li> | |
<ul> | |
<li> | |
<input type="text" name="Question[Answers][0].Name" value="Answer 1 Name" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/question" method="post"> | |
<ul> | |
<li> | |
<input type="text" name="Name" value="Question Name" /> | |
<input type="text" name="Id" value="1" /> | |
</li> | |
<li> | |
<ul> | |
<li> | |
<input type="text" name="Answers[0].Name" value="Answer 1 Name" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post["/question"] = parameters => | |
{ | |
Question question = this.Bind(); | |
return View["question.html", question]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Question | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public List<Answer> Answers { get; set; } | |
public List<Comment> Comments { get; set; } | |
} | |
public class Answer | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_models_from_dictionary(model, field_dict): | |
if isinstance(model, Model): | |
model_instance = model | |
check_fks = True | |
else: | |
model_instance = model() | |
check_fks = False | |
models = [model_instance] | |
for field_name, value in field_dict.items(): | |
field_obj = model._meta.fields[field_name] |
NewerOlder