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
prop.SetGetMethod(get_method); | |
prop.SetSetMethod(set_method); | |
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
model_type = class_obj.CreateType |
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
model_type = class_obj.CreateType |
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
@target_unit = CodeCompileUnit.new | |
@nspace_holder = CodeNamespace.new(@namespace) | |
@nspace_holder.Imports.Add CodeNamespaceImport.new(@model_namespace) |
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
@target_class = CodeTypeDeclaration.new(@class_name) | |
@target_class.IsClass = true | |
@target_class.TypeAttributes = class_attrs | |
@nspace_holder.Types.Add(@target_class) |
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 add_field(name, type, attributes = MemberAttributes.Public) | |
field = CodeMemberField.new | |
field.Attributes = attributes | |
field.Name = name | |
field.Type = CodeTypeReference.new type | |
field.Comments.Add( CodeCommentStatement.new("Repository")) | |
@target_class.Members.Add(field) | |
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
def add_constructor | |
arg_name = "repo" | |
# Create the constructor's object | |
ctor = CodeConstructor.new | |
ctor.Attributes = MemberAttributes.Public | |
ctor.Parameters.Add(CodeParameterDeclarationExpression.new("IRepository", arg_name)) | |
# Grab the references for both the parameter we just added and the field we created | |
# earlier | |
arg_ref = CodeArgumentReferenceExpression.new(arg_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
def create_if_else_statement(condition, true_statements, false_statements) | |
is_null_check = CodeConditionStatement.new | |
is_null_check.Condition = condition | |
is_null_check.TrueStatements.Add(true_statements) | |
is_null_check.FalseStatements.Add(false_statements) | |
is_null_check | |
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
def basic_method(name, return_type, attrs = MemberAttributes.Public) | |
method = CodeMemberMethod.new | |
method.Attributes = attrs | |
method.Name = name | |
method.ReturnType = return_type | |
method | |
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
def create_repo_method_call(method_name) | |
repo_call = CodeMethodInvokeExpression.new() | |
repo_call.Method = CodeMethodReferenceExpression.new( | |
CodeTypeReferenceExpression.new( CodeTypeReference.new("_repo")), | |
method_name, | |
@code_type_ref_of_model.ToArray) | |
repo_call | |
end |