This is a MODEL first approach. I have already researched this extensiely and have not come up with an answer. I have tried all the suggestions at the following links:
This appears to be the same problem but with no resolution The entity type <classname> is not part of the model for the current context
These are the links I have already researched so please don't answer as duplicate of ---- EF 4.1 Code First error - The entity type …
我尝试编写一个用户名字段验证器,其中一个要求是该字段必须包含至少 2 个数字(多一点也可以,不能少一点)。我想我可以做这样的事情,正则表达式在第一个数字上分裂,但从不在第二个数字上分裂。
String[] arr = string.split("[0-9][0-9]");
return arr.length > 2;
Run Code Online (Sandbox Code Playgroud)
使用案例:Bob11 Bo1b1 11Bob 1Bob1