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
if defined? IronRuby | |
def add_dotnet_friendly_method_aliases_for(klass) | |
klass.public_instance_methods.each do |method| | |
klass.instance_eval do | |
dotnet_friendly_name = IronRuby::Clr::Name.unmangle(method) | |
alias_method dotnet_friendly_name, method unless dotnet_friendly_name.nil? # in this case, it's already a dotnet friendly name | |
end | |
end | |
end | |
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 Customer | |
attr_reader :name | |
attr_reader :email | |
def initialize(name, email) | |
@name = name | |
@email = email | |
end | |
end | |
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 ObjectFactory | |
def self.create_from_nhibernate_hash(hashtable) | |
entity_name = hashtable[NHibernator::TYPE_KEY_NAME.to_clr_string] | |
entity = const_get(entity_name.to_sym).new | |
entity.hydrate_from hashtable | |
entity | |
end | |
def self.create_proxy_from_nhibernate_hash(hashtable, entity_name, id) | |
proxy = const_get("#{entity_name}Proxy".to_sym).new |
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 = sessionFactory.OpenSession()) | |
{ | |
var artistHash = session.CreateCriteria("Artist") | |
.Add(Restrictions.IdEq(artistId)) | |
.SetFetchMode("albums", FetchMode.Join) | |
.List()[0]; | |
dynamic artist = ruby.ObjectFactory.create_from_nhibernate_hash(artistHash); | |
Console.WriteLine("display output from session.CreateCriteria without any lazy loading"); | |
PrintArtistData(artist); |
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 entity-name="Artist"> | |
<id name="id" column="ArtistId" type="int"> | |
<generator class="identity"/> | |
</id> | |
<property name="name" length="50" type="string" /> | |
<bag name="albums" cascade="all-delete-orphan" inverse="true" > | |
<key column="ArtistId"/> | |
<one-to-many class="Album" /> |
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 AuthorizationDto | |
{ | |
public long Id { get; set; } | |
public Guid ApplicationId { get; set; } | |
public string ApplicationName { get; set; } | |
public Guid? UserGroupId { get; set; } | |
public string UserGroupName { get; set; } | |
public Guid? UserId { get; set; } | |
public string Username { get; set; } | |
public Guid PermissionId { 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
class Something | |
include EventPublisher | |
event :some_event | |
end |
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 Event | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
@handlers = [] | |
end | |
def +(eventhandler) |
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
[TestMethod] | |
public void SettingNameRaisesPropertyChangedEvent() | |
{ | |
AssertThatPropertyChangesIsTriggeredCorrectly(m => m.Name, "some name"); | |
} | |
[TestMethod] | |
public void SettingNameToInvalidValueCausesValidationError() | |
{ | |
BindingModel.Name = null; |
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 UserGroupDetailBindingModel : BindingModel<UserGroupDetailBindingModel> | |
{ | |
private string originalName; | |
private Guid? originalId; | |
private UserGroupDto originalSelectedParent; | |
public ObservableCollection<UserGroupDto> SuitableParentUserGroups { get; private set; } | |
private UserGroupDto selectedParentUserGroup; | |