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
// Creating a field on the type | |
FieldBuilder field = typeBuilder.DefineField("nameOfField", typeof (string), FieldAttributes.Private); | |
// Adding a new property to the type | |
PropertyBuilder property = typeBuilder.DefineProperty("NameOfProperty", | |
PropertyAttributes.HasDefault, | |
typeof (string), null); | |
// A property needs the actual implementation-method. Here the a getter | |
MethodBuilder getterMethod = typeBuilder.DefineMethod("get_NameOfProperty", |
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
class ContextCreatedByDriver{ | |
public IQueryable<TheType> TheType | |
{ | |
get{/* your implementation */} | |
} | |
} |
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 interface ComplexEventHandler { | |
void ohMyGod(String name,String otherName, int test); | |
} |
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 class Db4oExtensions | |
{ | |
public static void InTransaction(this IObjectContainer container, | |
Action<IObjectContainer> txClosure ) | |
{ | |
InTransaction(container, c => | |
{ | |
txClosure(c); | |
return true; | |
}); |
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
using (var session = documentStore.OpenSession()) | |
{ | |
var person = (from p in session.Query<Person>() | |
where p.SirName == "Stoffel" | |
select p).First(); | |
session.Delete(person); | |
session.SaveChanges(); | |
} |
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
var order = session.Query<Order>() | |
.Customize(x => x.Include<Order>(o=>o.CustomerId)) // Load also the costumer | |
.First(); | |
var customer = session.Load<Customer>(order.CustomerId); |
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
// Include all changes since the last 'SavenChanges' | |
var johns = (from c in session.Query<Customer>() | |
.Customize(q => q.WaitForNonStaleResultsAsOfLastWrite()) | |
where c.Name == "John" | |
select c).Take(5); |
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 BlogPost | |
{ | |
public BlogPost(string title) | |
{ | |
Title = title; | |
} | |
public string Id { get; set; } | |
public string Title { get; set; } | |
public string Content { get; set; } |
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
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080); |
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 BlogPost | |
{ | |
public BlogPost(string title) | |
{ | |
Title = title; | |
} | |
public string Id { get; set; } | |
public string Title { get; set; } | |
public byte[] Picture { get; set; } |