本文整理汇总了C#中ICodeBuilder.AddReferencesFromDependency方法的典型用法代码示例。如果您正苦于以下问题:C# ICodeBuilder.AddReferencesFromDependency方法的具体用法?C# ICodeBuilder.AddReferencesFromDependency怎么用?C# ICodeBuilder.AddReferencesFromDependency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICodeBuilder
的用法示例。
在下文中一共展示了ICodeBuilder.AddReferencesFromDependency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (InvalidDataInfo)conceptInfo;
// Using nonstandard naming of variables to avoid name clashes with injected code.
string getErrorMessageMethod =
@"public IEnumerable<InvalidDataMessage> " + info.GetErrorMessageMethodName() + @"(IEnumerable<Guid> invalidData_Ids)
{
const string invalidData_Description = " + CsUtility.QuotedString(info.ErrorMessage) + @";
" + OverrideUserMessagesTag.Evaluate(info) + @" return invalidData_Ids.Select(id => new InvalidDataMessage { ID = id, Message = invalidData_Description });
}
";
codeBuilder.InsertCode(getErrorMessageMethod, RepositoryHelper.RepositoryMembers, info.Source);
codeBuilder.AddReferencesFromDependency(typeof(InvalidDataMessage));
string dataStructure = info.Source.Module.Name + "." + info.Source.Name;
string systemMessage = @"""DataStructure:" + dataStructure + @",ID:"" + invalidItemId.ToString()" + SystemMessageAppendTag.Evaluate(info);
string validationSnippet =
@"if (insertedNew.Count() > 0 || updatedNew.Count() > 0)
{
Guid[] changedItemsId = inserted.Concat(updated).Select(item => item.ID).ToArray();
Guid invalidItemId = this.Filter(this.Query(changedItemsId), new " + info.FilterType + @"())
.Select(item => item.ID).FirstOrDefault();
if (invalidItemId != default(Guid))
{
var userMessage = " + info.GetErrorMessageMethodName() + @"(new[] { invalidItemId }).Single();
string systemMessage = " + systemMessage + @";
throw new Rhetos.UserException(userMessage.Message, userMessage.MessageParameters, systemMessage, null);
}
}
";
codeBuilder.InsertCode(validationSnippet, WritableOrmDataStructureCodeGenerator.OnSaveTag2, info.Source);
codeBuilder.AddReferencesFromDependency(typeof(UserException));
}
示例2: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
codeBuilder.InsertCode(CodeSnippet);
codeBuilder.AddReference(CaptionsResourceGenerator.ResourcesAssemblyDllPath);
codeBuilder.AddReferencesFromDependency(typeof(Guid));
codeBuilder.AddReferencesFromDependency(typeof(System.Linq.Enumerable));
codeBuilder.AddReferencesFromDependency(typeof(System.ComponentModel.DefaultValueAttribute)); // using namespace System.ComponentModel
codeBuilder.AddReferencesFromDependency(typeof(System.ComponentModel.DataAnnotations.DisplayAttribute)); // using namespace System.ComponentModel.DataAnnotations
}
示例3: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (ReportFileInfo)conceptInfo;
codeBuilder.InsertCode(RepositoryFunctionsSnippet(info), RepositoryHelper.RepositoryMembers, info);
codeBuilder.InsertCode("IReportRepository", RepositoryHelper.RepositoryInterfaces, info);
codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);
codeBuilder.AddReferencesFromDependency(typeof(ReportFile));
codeBuilder.AddReferencesFromDependency(typeof(IReportRepository));
}
示例4: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (ReportDataInfo)conceptInfo;
codeBuilder.InsertCode(ServiceRegistrationCodeSnippet(info), InitialCodeGenerator.ServiceRegistrationTag);
codeBuilder.InsertCode(ServiceInitializationCodeSnippet(info), InitialCodeGenerator.ServiceInitializationTag);
codeBuilder.InsertCode(ServiceDefinitionCodeSnippet(info), InitialCodeGenerator.RhetosRestClassesTag);
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.RestGenerator.Utilities.ServiceUtility));
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.RestGenerator.Utilities.DownloadReportResult));
codeBuilder.AddReferencesFromDependency(typeof(Newtonsoft.Json.JsonConvert));
}
示例5: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DataStructureInfo)conceptInfo;
if (info.Module.Name == "Common" && info.Name == "PermissionBrowse")
{
codeBuilder.InsertCode("Rhetos.Dom.DefaultConcepts.IPermissionLoader", RepositoryHelper.RepositoryInterfaces, info);
codeBuilder.InsertCode(MemberFunctionsSnippet, RepositoryHelper.RepositoryMembers, info);
codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);
codeBuilder.AddReferencesFromDependency(typeof(IPermissionLoader));
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Security.Claim));
}
}
示例6: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (ActionInfo)conceptInfo;
RepositoryHelper.GenerateRepository(info, codeBuilder);
codeBuilder.InsertCode("IActionRepository", RepositoryHelper.RepositoryInterfaces, info);
codeBuilder.InsertCode(RepositoryFunctionsSnippet(info), RepositoryHelper.RepositoryMembers, info);
codeBuilder.InsertCode(RegisterRepository(info), ModuleCodeGenerator.CommonAutofacConfigurationMembersTag);
codeBuilder.AddReferencesFromDependency(typeof(ExportAttribute));
codeBuilder.AddReferencesFromDependency(typeof(ExportMetadataAttribute));
codeBuilder.AddReferencesFromDependency(typeof(MefProvider));
}
示例7: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DenyUserEditInfo)conceptInfo;
codeBuilder.InsertCode(CheckChangesOnInsertSnippet(info), WritableOrmDataStructureCodeGenerator.ArgumentValidationTag, info.Property.DataStructure);
codeBuilder.InsertCode(CheckChangesOnUpdateSnippet(info), WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Property.DataStructure);
codeBuilder.AddReferencesFromDependency(typeof(UserException));
}
示例8: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
DataStructureInfo info = (DataStructureInfo)conceptInfo;
if (IsTypeSupported(info))
{
codeBuilder.InsertCode(ServiceRegistrationCodeSnippet(info), InitialCodeGenerator.ServiceRegistrationTag);
codeBuilder.InsertCode(ServiceInitializationCodeSnippet(info), InitialCodeGenerator.ServiceInitializationTag);
codeBuilder.InsertCode(ServiceDefinitionCodeSnippet(info), InitialCodeGenerator.RhetosRestClassesTag);
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Processing.DefaultCommands.ReadCommandResult));
codeBuilder.AddReferencesFromDependency(typeof(Newtonsoft.Json.Linq.JToken));
if (info is IWritableOrmDataStructure)
WritableOrmDataStructureCodeGenerator.GenerateCode(conceptInfo, codeBuilder);
}
}
示例9: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DeactivatableInfo)conceptInfo;
codeBuilder.InsertCode(DefaultSnippet(info), WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Entity);
codeBuilder.InsertCode("Rhetos.Dom.DefaultConcepts.IDeactivatable", DataStructureCodeGenerator.InterfaceTag, info.Entity);
codeBuilder.AddReferencesFromDependency(typeof(IDeactivatable));
}
示例10: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
DataStructureInfo info = (DataStructureInfo)conceptInfo;
codeBuilder.InsertCode(ImplementationCodeSnippet(info));
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Mvc.BaseMvcModel));
_localizedDisplayAttribute.InsertOrOverrideAttribute(codeBuilder, info, LocalizedDisplayAttributeProperties(info));
}
示例11: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (UserRequiredPropertyInfo)conceptInfo;
if (IsSupported(info.Property))
{
codeBuilder.InsertCode(CheckDataSnippet(info), WritableOrmDataStructureCodeGenerator.ArgumentValidationTag, info.Property.DataStructure);
codeBuilder.AddReferencesFromDependency(typeof(UserException));
}
}
示例12: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DataStructureInfo)conceptInfo;
if (info.Module.Name == "Common" && info.Name == "Claim")
codeBuilder.InsertCode(RepositoryMemberSnippet(info), RepositoryHelper.RepositoryMembers, info);
codeBuilder.AddReferencesFromDependency(typeof(DeactivateInsteadOfDelete));
}
示例13: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (AutoCodeCachedInfo)conceptInfo;
string snippet = string.Format(
@"Rhetos.Dom.DefaultConcepts.AutoCodeHelper.UpdateCodes(
_executionContext.NHibernateSession, ""{0}.{1}"", ""{2}"",
insertedNew.Select(item => new Rhetos.Dom.DefaultConcepts.AutoCodeItem<{0}.{1}> {{ Item = item, Code = item.{2}, Grouping = """" }}),
(item, newCode) => item.{2} = newCode);
",
info.Property.DataStructure.Module.Name,
info.Property.DataStructure.Name,
info.Property.Name);
codeBuilder.InsertCode(snippet, WritableOrmDataStructureCodeGenerator.OldDataLoadedTag, info.Property.DataStructure);
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Dom.DefaultConcepts.AutoCodeHelper));
codeBuilder.AddReferencesFromDependency(typeof(Rhetos.Dom.DefaultConcepts.AutoCodeItem<>));
}
示例14: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (UniqueMultiplePropertiesInfo)conceptInfo;
if (IsSupported(info))
{
codeBuilder.InsertCode(CheckSavedItemsSnippet(info), WritableOrmDataStructureCodeGenerator.OnSaveTag2, info.DataStructure);
codeBuilder.AddReferencesFromDependency(typeof(UserException));
}
}
示例15: GenerateCode
public void GenerateCode(IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (ModuleExternalReferenceInfo)conceptInfo;
var type = Type.GetType(info.TypeOrAssembly);
if (type != null)
codeBuilder.AddReferencesFromDependency(type);
else
codeBuilder.AddReference(info.TypeOrAssembly);
}