本文整理汇总了C#中SchemaBuilder类的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder类的具体用法?C# SchemaBuilder怎么用?C# SchemaBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchemaBuilder类属于命名空间,在下文中一共展示了SchemaBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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;
}
}
示例3: Start
public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
{
if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
{
PermissionAuthLogic.RegisterPermissions(MapPermission.ViewMap);
}
}
示例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;
}
}
示例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);
}
示例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();
}
}
示例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();
}
示例8: GetOrCreateSchema
public override Schema GetOrCreateSchema()
{
SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
sb.SetSchemaName(SchemaName);
sb.AddSimpleField("someBool", typeof(bool));
return sb.Finish();
}
示例9: GetOrCreateSchema
public override Schema GetOrCreateSchema()
{
SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
sb.SetSchemaName(SchemaName);
sb.AddArrayField("someStringArray", typeof(string));
return sb.Finish();
}
示例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;
}
}
示例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
}
示例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";
}
}
示例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;
}
}
示例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();
}
}
示例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)));
}
}