📄 abstractrecord.cs
字号:
public static void UnregisterChangedListener(Type type, RecordHandler handler) { changedRecordListeners[type] -= handler; } public static bool TypeIsRecordList(Type t) { if (t.Name == "IRecordList`1") return true; Type[] interfaces = t.GetInterfaces(); foreach (Type iface in interfaces) if (iface.Name == "IRecordList`1") return true; return false; } public static explicit operator int(AbstractRecord r) { return r.Id; } private static Dictionary<Type, MethodInfo> typeLoaderMethods = new Dictionary<Type, MethodInfo>(); public static object[] intParamArray = new object[] { 1 }; public static AbstractRecord Load(Type t, int id) { if( ! typeLoaderMethods.ContainsKey(t) ) { MethodInfo mi = t.GetMethod("Load",BindingFlags.Public|BindingFlags.Static|BindingFlags.FlattenHierarchy,null, new Type[]{typeof(int)},null); typeLoaderMethods[t] = mi.MakeGenericMethod(t); } intParamArray[0] = id; return (AbstractRecord)typeLoaderMethods[t].Invoke(null, intParamArray); } virtual protected RecordList<C> LoadChildren<C>(ColumnInfo fi) where C : AbstractRecord, new() {throw new Exception("AbstractRecord.LoadChildren not implemented.");} protected static PropertyTypeAttribute getPropertyTypeAttribute(PropertyInfo prop) { PropertyTypeAttribute[] ptas = prop.GetCustomAttributes(typeof(PropertyTypeAttribute), true) as PropertyTypeAttribute[]; PropertyTypeAttribute pta = null; if (ptas != null && ptas.Length > 0) { pta = ptas[0]; } return pta; } protected static List<PropertyInfo> DiscoverDerivedProperties(Type modelType) { List<PropertyInfo> properties = new List<PropertyInfo>(); PropertyInfo[] derivedProperties = modelType.GetProperties(); PropertyInfo[] baseProperties = modelType.BaseType.GetProperties(); foreach (PropertyInfo dp in derivedProperties) { bool inBase = false; foreach (PropertyInfo bp in baseProperties) { if (dp.Name == bp.Name) { inBase = true; } } if (!inBase) { properties.Add(dp); } } return properties; } #region randomWordStuffer static protected Random r; static string[] words; static Dictionary<string,List<string>> source = new Dictionary<string,List<string>>(); static AbstractRecord() { r = new Random(); #region wordset string wordset = @"Champagne (province) From Wikipedia, free encyclopedia. Champagne is one of traditional provinces of France, a region of France that is best known for production of sparkling white wine that bears region's name. Champagne is now part of French administrative region of Champagne-Ardenne. [edit] History Until 1284 County of Champagne was in essence an independent territory, whose count nominally owed fealty to king of France. [edit] Champagne fairs Champagne fairs were a circuit of six cloth fairs in towns of Champagne and Brie, changing location every two months and spanning year from January to October. At their height, in 13th century, Champagne fairs linked cloth-producing cities of Low Countries with Italian dyeing and exporting centers. fairs, which were already well-organized at start of century, were one of earliest manifestations of a linked European economy, which characterizes High Middle Ages. towns provided huge warehouses (still to be seen at Provins). From north came woollens and linen cloth. From south came pepper and other spices, drugs, coinage and new conceptions of credit and bookkeeping. Goods converged from Spain, travelling along well-established pilgrim route from Santiago de Compostela, and from Germany. Once cloth sales had been concluded, reckoning of credit at tables (banche) of Italian money-changers effected compensatory payments for goods, established future payments on credit, made loans to princes and lords, and settled bills of exchange, which were generally worded to expire at one of Champagne fairs. Italian credit was able to exploit every exchange in process, and Italian cloth merchants, depending on northern production for their trade in Levant, became great bankers of later Middle Ages. It was to interest of Count of Champagne, virtually independent of his nominal suzerain, King of France, to extend liberties and prerogatives of towns. Traditional historians have dated decline of Champagne fairs to conquest of Champagne by Philip Bold in 1273 and its inclusion within Crown of France by Philip IV in 1284. A sea route had been established, inaugurated by first appearance of Genoese ships in Antwerp in 1277.On Duty of Civil DisobedienceFrom WikibooksJump to: navigation, searchby Henry David ThoreauI heartily accept motto, ""That government is best which governs least""; and I should like to see it acted up to more rapidly and systematically. Carried out, it finally amounts to this, which also I believe--""That government is best which governs not at all""; and when men are prepared for it, that will be kind of government which they will have. Government is at best but an expedient; but most governments are usually, and all governments are sometimes, inexpedient. objections which have been brought against a standing army, and they are many and weighty, and deserve to prevail, may also at last be brought against a standing government. standing army is only an arm of standing government. government itself, which is only mode which people have chosen to execute their will, is equally liable to be abused and perverted before people can act through it. Witness present Mexican war, work of comparatively a few individuals using standing government as their tool; for in outset, people would not have consented to this measure.This American government--what is it but a tradition, though a recent one, endeavoring to transmit itself unimpaired to posterity, but each instant losing some of its integrity? It has not vitality and force of a single living man; for a single man can bend it to his will. It is a sort of wooden gun to people themselves. But it is not less necessary for this; for people must have some complicated machinery or other, and hear its din, to satisfy that idea of government which they have. Governments show thus how successfully men can be imposed upon, even impose on themselves, for their own advantage. It is excellent, we must all allow. Yet this government never of itself furthered any enterprise, but by alacrity with which it got out of its way. It does not keep country free. It does not settle West. It does not educate. character inherent in American people has done all that has been accomplished; and it would have done somewhat more, if government had not sometimes got in its way. For government is an expedient, by which men would fain succeed in letting one another alone; and, as has been said, when it is most expedient, governed are most let alone by it. Trade and commerce, if they were not made of india-rubber, would never manage to bounce over obstacles which legislators are continually putting in their way; and if one were to judge these men wholly by effects of their actions and not partly by their intentions, they would deserve to be classed and punished with those mischievious persons who put obstructions on railroads.But, to speak practically and as a citizen, unlike those who call themselves no-government men, I ask for, not at once no government, but at once a better government. Let every man make known what kind of government would command his respect, and that will be one step toward obtaining it.After all, practical reason why, when power is once in hands of people, a majority are permitted, and for a long period continue, to rule is not because they are most likely to be in right, nor because this seems fairest to minority, but because they are physically strongest. But a government in which majority rule in all cases can not be based on justice, even as far as men understand it. Can there not be a government in which majorities do not virtually decide right and wrong, but conscience?--in which majorities decide only those questions to which rule of expediency is applicable? Must citizen ever for a moment, or in least degree, resign his conscience to legislator? Why has every man a conscience then? I think that we should be men first, and subjects afterward. It is not desirable to cultivate a respect for law, so much as for right. only obligation which I have a right to assume is to do at any time what I think right. It is truly enough said that a corporation has no conscience; but a corporation on conscientious men is a corporation with a conscience. Law never made men a whit more just; and, by means of their respect for it, even well-disposed are daily made agents on injustice. A common and natural result of an undue respect for law is, that you may see a file of soldiers, colonel, captain, corporal, privates, powder-monkeys, and all, marching in admirable order over hill and dale to wars, against their wills, ay, against their common sense and consciences, which makes it very steep marching indeed, and produces a palpitation of heart. They have no doubt that it is a damnable business in which they are concerned; they are all peaceably inclined. Now, what are they? Men at all? or small movable forts and magazines, at service of some unscrupulous man in power? Visit Navy Yard, and behold a marine, such a man as an American government can make, or such as it can make a man with its black arts--a mere shadow"";and reminiscence of humanity, a man laid out alive and standing, and already, as one may say, buried under arms with funeral accompaniment, though it may be,""Not a drum was heard, not a funeral note,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -