本文整理汇总了C#中SchemaBuilder类的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder类的具体用法?C# SchemaBuilder怎么用?C# SchemaBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchemaBuilder类属于命名空间,在下文中一共展示了SchemaBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Start
internal static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
sb.Include<ChartScriptEntity>();
dqm.RegisterQuery(typeof(ChartScriptEntity), () =>
from uq in Database.Query<ChartScriptEntity>()
select new
{
Entity = uq,
uq.Id,
uq.Name,
uq.GroupBy,
uq.Columns.Count,
uq.Icon,
});
Scripts = sb.GlobalLazy(() =>
{
var result = Database.Query<ChartScriptEntity>().ToDictionary(a => a.Name);
foreach (var e in result.Values)
if (e.Icon != null)
e.Icon.Retrieve();
return result;
}, new InvalidateWith(typeof(ChartScriptEntity)));
RegisterOperations();
}
}
开发者ID:mapacheL,项目名称:extensions,代码行数:31,代码来源:ChartScriptLogic.cs
示例2: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
IsStarted = true;
AuthLogic.AssertStarted(sb);
sb.Include<UserTicketEntity>();
dqm.RegisterQuery(typeof(UserTicketEntity), () =>
from ut in Database.Query<UserTicketEntity>()
select new
{
Entity = ut,
ut.Id,
ut.User,
ut.Ticket,
ut.ConnectionDate,
ut.Device,
});
dqm.RegisterExpression((UserEntity u) => u.UserTickets(), () => typeof(UserTicketEntity).NicePluralName());
sb.Schema.EntityEvents<UserEntity>().Saving += UserTicketLogic_Saving;
}
}
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:26,代码来源:UserTicketLogic.cs
示例3: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
PermissionAuthLogic.RegisterPermissions(MapPermission.ViewMap);
}
}
开发者ID:mapacheL,项目名称:extensions,代码行数:7,代码来源:MapLogic.cs
示例4: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm, HashSet<Type> registerExpression)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
sb.Include<ViewLogEntity>();
dqm.RegisterQuery(typeof(ViewLogEntity), () =>
from e in Database.Query<ViewLogEntity>()
select new
{
Entity = e,
e.Id,
e.Target,
e.ViewAction,
e.User,
e.Duration,
e.StartDate,
e.EndDate,
});
ExceptionLogic.DeleteLogs += ExceptionLogic_DeleteLogs;
var exp = Signum.Utilities.ExpressionTrees.Linq.Expr((Entity entity) => entity.ViewLogs());
foreach (var t in registerExpression)
{
dqm.RegisterExpression(new ExtensionInfo(t, exp, exp.Body.Type, "ViewLogs", () => typeof(ViewLogEntity).NicePluralName()));
}
DynamicQueryManager.Current.QueryExecuted += Current_QueryExecuted;
sb.Schema.Table<TypeEntity>().PreDeleteSqlSync += Type_PreDeleteSqlSync;
}
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:33,代码来源:ViewLogLogic.cs
示例5: Start
public static void Start(string connectionString)
{
DBMS dbms = DBMS.SqlServer2008;
SchemaBuilder sb = new SchemaBuilder(dbms);
DynamicQueryManager dqm = new DynamicQueryManager();
if (dbms == DBMS.SqlCompact)
Connector.Default = new SqlCeConnector(@"Data Source=C:\BaseDatos.sdf", sb.Schema, dqm);
else
Connector.Default = new SqlConnector(connectionString, sb.Schema, dqm);
sb.Schema.Version = typeof(Starter).Assembly.GetName().Version;
sb.Schema.Settings.OverrideAttributes((OperationLogDN ol) => ol.User, new ImplementedByAttribute());
sb.Schema.Settings.OverrideAttributes((ExceptionDN e) => e.User, new ImplementedByAttribute());
Validator.PropertyValidator((OperationLogDN e) => e.User).Validators.Clear();
TypeLogic.Start(sb, dqm);
OperationLogic.Start(sb, dqm);
ExceptionLogic.Start(sb, dqm);
MusicLogic.Start(sb, dqm);
}
开发者ID:nuub666,项目名称:framework,代码行数:26,代码来源:Starter.cs
示例6: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
sb.Include<SmtpConfigurationEntity>();
dqm.RegisterQuery(typeof(SmtpConfigurationEntity), () =>
from s in Database.Query<SmtpConfigurationEntity>()
select new
{
Entity = s,
s.Id,
s.DeliveryMethod,
s.Network.Host,
s.Network.Username,
s.PickupDirectoryLocation
});
SmtpConfigCache = sb.GlobalLazy(() => Database.Query<SmtpConfigurationEntity>().ToDictionary(a => a.ToLite()),
new InvalidateWith(typeof(SmtpConfigurationEntity)));
new Graph<SmtpConfigurationEntity>.Execute(SmtpConfigurationOperation.Save)
{
AllowsNew = true,
Lite = false,
Execute = (sc, _) => { },
}.Register();
}
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:29,代码来源:SmtpConfigurationLogic.cs
示例7: Start
public static void Start(string connectionString)
{
SchemaBuilder sb = new SchemaBuilder();
DynamicQueryManager dqm = new DynamicQueryManager();
//Connector.Default = new SqlCeConnector(@"Data Source=C:\BaseDatos.sdf", sb.Schema, dqm);
Connector.Default = new SqlConnector(connectionString, sb.Schema, dqm, SqlServerVersion.SqlServer2008);
sb.Schema.Version = typeof(MusicStarter).Assembly.GetName().Version;
sb.Schema.Settings.FieldAttributes((OperationLogEntity ol) => ol.User).Add(new ImplementedByAttribute());
sb.Schema.Settings.FieldAttributes((ExceptionEntity e) => e.User).Add(new ImplementedByAttribute());
Validator.PropertyValidator((OperationLogEntity e) => e.User).Validators.Clear();
TypeLogic.Start(sb, dqm);
OperationLogic.Start(sb, dqm);
ExceptionLogic.Start(sb, dqm);
MusicLogic.Start(sb, dqm);
sb.Schema.OnSchemaCompleted();
}
开发者ID:rondoo,项目名称:framework,代码行数:26,代码来源:MusicStarter.cs
示例8: GetOrCreateSchema
public override Schema GetOrCreateSchema()
{
SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
sb.SetSchemaName(SchemaName);
sb.AddSimpleField("someBool", typeof(bool));
return sb.Finish();
}
开发者ID:halad,项目名称:RevitLookup,代码行数:7,代码来源:EStorageBundle1.cs
示例9: GetOrCreateSchema
public override Schema GetOrCreateSchema()
{
SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
sb.SetSchemaName(SchemaName);
sb.AddArrayField("someStringArray", typeof(string));
return sb.Finish();
}
开发者ID:jeremytammik,项目名称:RevitLookup,代码行数:7,代码来源:EStorageBundle2.cs
示例10: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
AuthLogic.AssertStarted(sb);
sb.Include<SessionLogEntity>();
PermissionAuthLogic.RegisterPermissions(SessionLogPermission.TrackSession);
dqm.RegisterQuery(typeof(SessionLogEntity), () =>
from sl in Database.Query<SessionLogEntity>()
select new
{
Entity = sl,
sl.Id,
sl.User,
sl.SessionStart,
sl.SessionEnd,
sl.SessionTimeOut
});
ExceptionLogic.DeleteLogs += ExceptionLogic_DeleteLogs;
}
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:25,代码来源:SessionLogLogic.cs
示例11: CreateSchemeAndStoreData
// Create a data structure, attach it to a wall, populate it with data, and retrieve the data back from the wall
public void CreateSchemeAndStoreData(FamilySymbol titleblock)
{
SchemaBuilder schemaBuilder = new SchemaBuilder(new Guid("1a68d420-96dd-44aa-a1de-000774a6104b"));
schemaBuilder.SetReadAccessLevel(AccessLevel.Public); // allow anyone to read the object
schemaBuilder.SetSchemaName("TitleBlockSettings");
// create a field to store data
FieldBuilder fieldBuilder_titleblockName = schemaBuilder.AddSimpleField("titleblockName", typeof(string));
FieldBuilder fieldBuilder_cellSizeDistance_X = schemaBuilder.AddSimpleField("cellSizeDistance_X", typeof(string));
//fieldBuilder_cellSizeDistance_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_lowerGap_X = schemaBuilder.AddSimpleField("lowerGap_X", typeof(string));
//fieldBuilder_lowerGap_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_additionalEdge_X = schemaBuilder.AddSimpleField("additionalEdge_X", typeof(string));
//fieldBuilder_additionalEdge_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_fineTune_X = schemaBuilder.AddSimpleField("fineTune_X", typeof(string));
//fieldBuilder_fineTune_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_cellSizeDistance_Y = schemaBuilder.AddSimpleField("cellSizeDistance_Y", typeof(string));
//fieldBuilder_cellSizeDistance_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_lowerGap_Y = schemaBuilder.AddSimpleField("lowerGap_Y", typeof(string));
//fieldBuilder_lowerGap_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_additionalEdge_Y = schemaBuilder.AddSimpleField("additionalEdge_Y", typeof(string));
//fieldBuilder_additionalEdge_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_fineTune_Y = schemaBuilder.AddSimpleField("fineTune_Y", typeof(string));
//fieldBuilder_fineTune_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_cellGrid_Length = schemaBuilder.AddSimpleField("cellGrid_Length", typeof(string));
FieldBuilder fieldBuilder_cellGrid_Height = schemaBuilder.AddSimpleField("cellGrid_Height", typeof(string));
//fieldBuilder.SetDocumentation("store length of cell size in X direction.");
Schema schema = schemaBuilder.Finish(); // register the Schema object
}
开发者ID:dannysbentley,项目名称:alignviewtosheetcell,代码行数:35,代码来源:SchemaAndStoreData.cs
示例12: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
sb.Include<ExceptionEntity>();
dqm.RegisterQuery(typeof(ExceptionEntity),()=>
from r in Database.Query<ExceptionEntity>()
select new
{
Entity = r,
r.Id,
r.CreationDate,
r.ExceptionType,
ExcepcionMessage = r.ExceptionMessage,
r.StackTraceHash,
});
dqm.RegisterQuery(typeof(ExceptionEntity), ()=>
from r in Database.Query<ExceptionEntity>()
select new
{
Entity = r,
r.Id,
r.CreationDate,
r.ExceptionType,
ExcepcionMessage = r.ExceptionMessage,
r.StackTraceHash,
});
DefaultEnvironment = "Default";
}
}
开发者ID:rondoo,项目名称:framework,代码行数:33,代码来源:ExceptionLogic.cs
示例13: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
sb.Include<DynamicValidationEntity>()
.WithSave(DynamicValidationOperation.Save)
.WithQuery(dqm, e => new
{
Entity = e,
e.Id,
e.Name,
e.EntityType,
e.PropertyRoute,
e.Eval,
});
DynamicValidations = sb.GlobalLazy(() =>
Database.Query<DynamicValidationEntity>()
.Select(dv => new DynamicValidationPair { Validation = dv, PropertyRoute = dv.PropertyRoute.ToPropertyRoute() })
.GroupToDictionary(a => a.PropertyRoute.PropertyInfo),
new InvalidateWith(typeof(DynamicValidationEntity)));
sb.Schema.Initializing += () => { initialized = true; };
Validator.GlobalValidation += DynamicValidation;
}
}
开发者ID:mapacheL,项目名称:extensions,代码行数:26,代码来源:DynamicValidationLogic.cs
示例14: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm, bool excelReport)
{
if (excelReport)
{
QueryLogic.Start(sb);
sb.Include<ExcelReportEntity>();
dqm.RegisterQuery(typeof(ExcelReportEntity), () =>
from s in Database.Query<ExcelReportEntity>()
select new
{
Entity = s,
s.Id,
s.Query,
s.File.FileName,
s.DisplayName,
});
new Graph<ExcelReportEntity>.Execute(ExcelReportOperation.Save)
{
AllowsNew = true,
Lite = false,
Execute = (er, _) => { }
}.Register();
new Graph<ExcelReportEntity>.Delete(ExcelReportOperation.Delete)
{
Lite = true,
Delete = (er, _) => { er.Delete(); }
}.Register();
}
}
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:32,代码来源:ExcelLogic.cs
示例15: Start
public static void Start(SchemaBuilder sb)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
// QueryManagers = queryManagers;
sb.Schema.Initializing += () =>
{
queryNamesLazy.Load();
queryNameToEntityLazy.Load();
};
sb.Include<QueryEntity>();
sb.Schema.Synchronizing += SynchronizeQueries;
sb.Schema.Generating += Schema_Generating;
queryNamesLazy = sb.GlobalLazy(()=>CreateQueryNames(), new InvalidateWith(typeof(QueryEntity)));
queryNameToEntityLazy = sb.GlobalLazy(() =>
EnumerableExtensions.JoinStrict(
Database.Query<QueryEntity>().ToList(),
QueryNames,
q => q.Key,
kvp => kvp.Key,
(q, kvp) => KVP.Create(kvp.Value, q),
"caching QueryEntity. Consider synchronize").ToDictionary(),
new InvalidateWith(typeof(QueryEntity)));
}
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:30,代码来源:QueryLogic.cs
示例16: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
FileTypeLogic.Start(sb, dqm);
sb.Include<FilePathEntity>();
sb.Schema.EntityEvents<FilePathEntity>().Retrieved += FilePathLogic_Retrieved;
sb.Schema.EntityEvents<FilePathEntity>().PreSaving += FilePath_PreSaving;
sb.Schema.EntityEvents<FilePathEntity>().PreUnsafeDelete += new PreUnsafeDeleteHandler<FilePathEntity>(FilePathLogic_PreUnsafeDelete);
dqm.RegisterQuery(typeof(FilePathEntity), () =>
from p in Database.Query<FilePathEntity>()
select new
{
Entity = p,
p.Id,
p.FileName,
p.FileType,
p.Sufix
});
new Graph<FilePathEntity>.Execute(FilePathOperation.Save)
{
AllowsNew = true,
Lite = false,
Execute = (fp, _) =>
{
if (!fp.IsNew)
{
var ofp = fp.ToLite().Retrieve();
if (fp.FileName != ofp.FileName || fp.Sufix != ofp.Sufix || fp.FullPhysicalPath != ofp.FullPhysicalPath)
{
using (Transaction tr = new Transaction())
{
var preSufix = ofp.Sufix.Substring(0, ofp.Sufix.Length - ofp.FileName.Length);
fp.Sufix = Path.Combine(preSufix, fp.FileName);
fp.Save();
System.IO.File.Move(ofp.FullPhysicalPath, fp.FullPhysicalPath);
tr.Commit();
}
}
}
}
}.Register();
OperationLogic.SetProtectedSave<FilePathEntity>(false);
sb.AddUniqueIndex<FilePathEntity>(f => new { f.Sufix, f.FileType }); //With mixins, add AttachToUniqueIndexes to field
dqm.RegisterExpression((FilePathEntity fp) => fp.WebImage(), () => typeof(WebImage).NiceName(), "Image");
dqm.RegisterExpression((FilePathEntity fp) => fp.WebDownload(), () => typeof(WebDownload).NiceName(), "Download");
}
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:59,代码来源:FilePathLogic.cs
示例17: GetSchema
public override Schema GetSchema()
{
var schema = base.GetSchema();
var schemaBuilder = new SchemaBuilder();
schema.CombineWith(new Schema(schemaBuilder.Inject(@"<Attribute Name=""" + ClassTypeToInstantiate + @""" RefNodeName=""/Application/BOModel/Class""/>", ModelElement.ListView)));
schema.CombineWith(new Schema(schemaBuilder.Inject(@"<Attribute Name=""" + ClassTypeToInstantiate + @""" RefNodeName=""/Application/BOModel/Class""/>", ModelElement.DetailView)));
return schema;
}
开发者ID:amraa,项目名称:eXpand,代码行数:8,代码来源:WinNewObjectViewController.cs
示例18: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
sb.Include<PasswordExpiresIntervalEntity>();
dqm.RegisterQuery(typeof(PasswordExpiresIntervalEntity), ()=>
from e in Database.Query<PasswordExpiresIntervalEntity>()
select new
{
Entity = e,
e.Id,
e.Enabled,
e.Days,
e.DaysWarning
});
new Graph<PasswordExpiresIntervalEntity>.Execute(PasswordExpiresIntervalOperation.Save)
{
AllowsNew = true,
Lite = false,
Execute = (pei, _) => { },
}.Register();
AuthLogic.UserLogingIn += (u =>
{
if (u.PasswordNeverExpires)
return;
var ivp = Database.Query<PasswordExpiresIntervalEntity>().Where(p => p.Enabled).FirstOrDefault();
if (ivp == null)
return;
if (TimeZoneManager.Now > u.PasswordSetDate.AddDays((double)ivp.Days))
throw new PasswordExpiredException(AuthMessage.ExpiredPassword.NiceToString());
});
AuthLogic.LoginMessage += (() =>
{
UserEntity u = UserEntity.Current;
if (u.PasswordNeverExpires)
return null;
PasswordExpiresIntervalEntity ivp = null;
using (AuthLogic.Disable())
ivp = Database.Query<PasswordExpiresIntervalEntity>().Where(p => p.Enabled).FirstOrDefault();
if (ivp == null)
return null;
if (TimeZoneManager.Now > u.PasswordSetDate.AddDays((double)ivp.Days).AddDays((double)-ivp.DaysWarning))
return AuthMessage.YourPasswordIsNearExpiration.NiceToString();
return null;
});
}
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:58,代码来源:PasswordExpiresLogic.cs
示例19: Generates_Extended_Property_String
public void Generates_Extended_Property_String()
{
var builder = new SchemaBuilder("procName");
var script = builder.GetScript();
const string expected =
@"EXECUTE sp_addextendedproperty @name = 'tSQLt.TestClass', @value = 1, @level0type = 'SCHEMA', @level0name = 'procName'";
Assert.IsTrue(script.IndexOf(expected) >= 0, script);
}
开发者ID:mwidmeyer,项目名称:Dacpac-2-tSQLtTests,代码行数:10,代码来源:SchemaBuilderTests.cs
示例20: Generates_Create_Schema_Statement
public void Generates_Create_Schema_Statement()
{
var builder = new SchemaBuilder("[procName]");
var script = builder.GetScript();
const string expected =
@"CREATE SCHEMA [procName]";
Assert.IsTrue(script.IndexOf(expected) >= 0);
}
开发者ID:mwidmeyer,项目名称:Dacpac-2-tSQLtTests,代码行数:10,代码来源:SchemaBuilderTests.cs
注:本文中的SchemaBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论